How to link image into html using the intellij idea IDE? - java

I have got a simple html page on intellij idea that uses a java class to display the webpage on the localhost:9002/.
I am using the bootstrap library and my images are not been parsed on my webpage properly.
I am looking for someone to specify the correct directory of images within intellij and if any changes should be made to the standard image link in my html.
My image link is as follows:
<a class="navbar-brand" href="ShoppingPortal.html"><img src="logo.png" alt="Company logo" style="width:225px;height:35px; padding-bottom: 2px;"></a>
Any ideas???
Thanks

If the image is in the same directory as your .html file then adding a forward slash -> src="/logo.png" should work.
If you are going to have more than one image it might be worth while adding an images directory to your root and then updating the src src="/images/logo.png"

Related

How to import static images from clientlib in a template using Adobe AEM?

I'm starting with Adobe AEM right now and as my first training, I was in need of importing a static image into a template.
I have a 100% static page but I can't seem to find out how to use an image that I've saved in /etc/designs/{MY_PROJ}/clientlib-site/img.
That's the real example of the problem I'm facing:
I've the following snippet inside my template:
<img src="/etc/designs/{MY_PROJ}/clientlib-site/img/logo.png"/>
My folder structure looks like the following (Link to imgur)
I was able to use the sly tag to import my CSS and JS correctly. But I really can't understand why I can't import images as well. Any thoughts?
Thanks in advance!
If you are able to access your image directly http://localhost:4502/etc/designs/{MY_PROJ}/clientlib-site/img/logo.png
but not in www.yourhost.org/etc/designs/{MY_PROJ}/clientlib-site/img/logo.png it could be some /filter Dispatcher configuration.
If you cannot see your image, make sure you have set the proper filter in your vault workspace like so:
<workspaceFilter version="1.0">
/etc/designs/{MY_PROJ}/
</workspaceFilter>
More info about Jackrabbit filters: http://jackrabbit.apache.org/filevault/filter.html
Have you checked in CRX/DE http://localhost:4502/crx/de/index.jsp? If the image file is not present at the designated path in crx/de, it means the package is not installed successfully.
Then check the workspace filter file (usually located at /META-INF/vault/filter.xml) and ensure the image path is included and reinstall the package and watch the logs. There should be an log entry like
A /etc/designs/{MY_PROJ}/clientlib-site/img/logo.png

What is the file path I need to use to view my html pages in my java project on netbeans?

I am using NetBeans IDE 8.2. I have a java web project, lets call it ProjectName. My project folder looks like this:
>ProjectName
>build
>dist
>nbproject
>src
>web
>index.html
>foo.html
>bar.html
>build.xml
Right now, if I run my project, a browser will open and display index.html. The URL reads "localhost:54782/ProjectName".
But I cannot view foo.html or bar.html. I have tried "localhost:54782/ProjectName/foo", and "localhost:54782/ProjectName/web/foo", and many other variations of this pattern. Please help me and tell me what I need to do to view my foo.html and bar.html.
You indicate that you tried localhost:54782/ProjectName/foo. Did you try it with the extension .html? if you did try it with localhost:54782/ProjectName/foo.html. It works by without the extension for index.html because there is a mapping defined in the web.xml file in the tag.

Wicket: load image from absolute path

Currently I render my images from my project's "webapp" directory using ContextRelativeResource:
Java:
add(new Image("image", new ContextRelativeResource("image.jpg")));
HTML:
<img wicket:id="image"/>
I would like to know how to display images from given absolute path, for example "C:\image.jpg". Any ideas?
What version of Wicket are you using?
You might want to consider mounting external resources. Go here.
OR use the Image's constructor that takes and ID and a WebResource.

JApplet works in applet viewer, not in HTML page

This topic has been covered in one form or another but none of the other threads have been able to help. My issue is very similar to this post, I am making a JUNG graph with added functionality, but none of the solutions helped:
JApplet fails to run in HTML page
I had a Java application that I converted to a JApplet. The JApplet works fine in the applet viewer in Eclipse but will not work when I try to open it in a webpage (I have tried IE, FireFox, and Chrome). I have my HTML page and archive folder both in the same directory. When I load the HTML page it just brings up nothing.
Here is my html code:
<html>
<title>Applet</title>
<head>
</head>
<body>
<applet code="prerna.blueprint.main.BPTester.class"
archive="applet1.jar"
width="800" height="800">
</applet>
</body>
</html>
When I try to have code="BPTester.class" it gives java.lang.ClassNotFoundException: BPTester.class but when I use code="prerna.blueprint.main.BPTester.class" it gives me no errors just nothing happens. (prerna/blueprint/main/BPTester.class is the file path in my src folder). I exported my Java project as a runnable jar file, is this correct? I created a simple JApplet that worked fine when I did all the same steps but it won't work for BPTester.class.
If I need to post my BPTester.class code I can.
I don't understand why I can't view the JApplet in a webpage, any help is greatly appreciated.
What ended up working for me was adding every single jar I used in the japplet to the HTML archive tag then had to sign every jar. I then had an issue with accessing my database within the applet1.jar so I just put an absolute path for its location.
java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
The applet needs to be digitally signed (by you) and trusted (by the end user, when prompted) before it can obtain such information. Given this applet is being deployed using a traditional applet element (i.e. not using web start), all jars need to be signed.
You need to sign every jar. You can sign all the jars with the jarsigner utility. Example:
jarsigner.exe "nameofthejar.jar" "alias"
Remove .class from the end. You either use a file path with slashes and .class at the end or you only use periods and no .class at the end.
Try turning on tracing in the java control panel. It will then produce a log file in the following path that may help: %USERPROFILE%\AppData\LocalLow\sun\java\Deployment\log

My Applet will not run in a browser

Can anyone help me out. I've written a program that controls the heating system in an imaginery house, an applet actually. it runs fine in netbeans but i cant get it to run as an applet in a browser, can anyone help me out please, I linked to a zip folder of all my code...
http://dl.dropbox.com/u/47863/Heating%20System.zip
http://alcaeos.com/applet/classes/MyHomeHeating.class -> 404.
Or to put that another way.
The applet element is telling the JRE to look for the class at the URL mentioned above.
The class is not at that location. (Neither is it in the same directory as the HTML.)
Where is the class file?
BTW: Typical bloody Netbeans generated code (/HTML). When what it generates is not invalid, it is redundant.
code="MyHomeHeating.class" The code attribute should not include .class.
<HR WIDTH="100%"> An HR element normally spans the entire width of the page.
You need to compile your applet into .class files (not .java files like you have in the ZIP; those are source code) and embed it into an HTML page. You can use the tag in HTML to do these; read more here: http://www.echoecho.com/applets01.htm

Categories

Resources