My favicon is in my web root folder, and most of my jsp views work just fine with it. All I have done is add:
<link href="favicon.ico" rel="icon" type="image/x-icon" />
to my and it seemed to work fine.
That was until I realized it wasn't showing up in some of my views. I read through the whole code, to see any differences, but I found none. After a while, I decided to copy and paste the code from the view that I had my favicon working to the one that didn't. And here's the weird thing: it still just shows up in one of the views. I have tried several browsers and it still doesn't show up in a view that literally has the same code (and gives no console errors) as the other one. Both views are in the same folder. How on earth is this even possible?
If any of your JSPs show in the browser with a different path (other than root), then the relative path you've specified for the favicon will look in the same path for it and not find it. If you use an absolute path for your favicon, they should all be able to see it.
Related
My problem is about stylesheets and javascript that aren't loading when I'm using a second / in my URL.
When I use <link rel="stylesheet" href="stylesheets/theme.css" /> it works for my base route but stops working when I go deeper, such as /home/webpage.
These are the errors I am getting in my Chrome console:
Refer to this stack overflow question
Essentially you need an assets manager. You can then load this assets manager in your main layout (if you have one) and have your other views extend your main layout.
I have developed a jsp page which is running perfectly in my system. But when I access this URL from another system in the same network some features are not available. Precisely, I have an SVG image which should be displayed and some other information along with it, which is coming from a hardware.
When I try to access from other systems this SVG is not displaying. But other information is correct. I cant find any error in my web console or eclipse console. What could be the reason?
Without seeing any of the code or your project structure. This sounds like a url problem. Sometimes relative urls to certain resources will not load if they are not in the correct directory. For example..
Imagine on your jsp page your svg image is at
/images/image.svg
Well this resource will not be accessible if the URL is pointing at /users/profiles/feed/
What you have to do in these cases is make sure that all your resources are absolute urls, or jump back directories like so:
../images/image.svg
or if you're up 2 directories
../../images/image.svg
I have a spring web project which basically Test webApp and capture screenshot of pages. The path of the saved image looks something like below:
"\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
\Demo\WEB-INF\Results\Test\1118015800\error\error_ST001_1.jpg"
I am trying to display the saved image on a JSP page and so far success has been elusive. I tried different combination of relative path also I tried to give absolute path but it doesn't work. My image tag looks something like this
<img src="<c:url value="/WEB-INF/Results/Test/1118015800/error/error_ST001_1.jpg" />" />
Does anyone have any idea on displaying the image? Could it be because files are stored inside the .metadata folder of Eclipse workspace that I am not able to display any image?
This is because the WEB-INF directory is special. The web container won't serve files from that location - that behavior is defined in the Servlet Spec.
You can either create a servlet that takes requests from the client, loads images (e.g. using getResourceAsStream()) and streams them back, or move the images to a different place in your web app hierarchy.
I'm working on a project for code school and am having trouble with the images on my site. While I'm on the index and initial pages (hosted on a local server), the leaderboard, home logo, and browser tab icon all work well. Then, for certain pages, all of those images suddenly fail.
The images are part of my layout.vtl file, and all other Velocity templates are parsed into the main layout file. Since they're in the main layout file, I feel like they should be accessible on every page of the site.
The images are stored in src/main/resources/public/img .
Some clarifying information:
I noticed that all the pages with good images are only one template deep (for example, localhost:4567/brands and localhost:4567/stores). The failing images are deeper into the site (localhost:4567/stores/12).
The pages with broken images require id's; the url above is accessed through $store.getCompany().
Any ideas?
The solution to this problem was adding a / so the link looks like
<img src='/img/leaderboard.png'>. Without the slash, the URL is relative. So for example, if you were at the URL /store, it would be looking for /store/img/leaderboard.png instead of /img/leaderboard.png.
For example purposes, let's say I have a series of Locations on a website and the urls are of the form /location/#/ where # is the id of the location I want to view. Since I'm using Django with Apache, all of my static content is in /media. Each Location page is trying to load a Java applet that allows for file uploads.
<applet
codebase="/media/java/"
code="com.elementit.JavaPowUpload.Manager"
archive="JavaPowUpload.jar, commons-logging-1.1.jar, commons-httpclient-3.1-rc1.jar, commons-codec-1.3.jar"
width="200"
height="100"
name="java-uploader"
id="id-java-uploader"
mayscript="true"
alt="JavaPowUpload by www.element-it.com"></applet>
All of the listed jar files are in /media/java/ and are found by the web server. The applet appears to load on the page without a problem but when looking at the network traffic during page load I see there are several errors. Basically the applet seems to be looking for files that are within the jar, say com.elementit.JavaPowUpload.Messages_en.class, but is asking the web server for them, which amounts to requesting /media/java/com/elementit/JavaPowUpload/Messages_en.class, which of course does not exist. Note that if I get rid of codebase and give the full path to each jar, I still have a similar problem where the request is then /location/#/com/elementit/JavaPowUpload/Messages_en.class. How do I set things up so that the jar file is searched rather than the filesystem?
See the codebase_lookup applet attribute.
Despite taking this code from another page on a different server, it appears there is a slight error in the applet's code attribute. Adding .class to the string fixed my problem, but I'm unsure why it works without it on the other host and page.
code="com.elementit.JavaPowUpload.Manager.class"