Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Image not dispalyed in one JSP but dispalyed in other  RSS feed

 
anees ahamed
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please refer the link given. This is the directory structure of one of my applications.

http://docs.google.com/View?id=dfzrknk_764x7hqbgq

I have encountered a small problem and need your valuable help in overcoming it. Also, I would be obliged if you could kindly let me know, why this problem occurs.

hrms_user_login.jsp -> servlet(authentication checking with db) -> hrms_default.jsp

The problem is, I have placed an image in the images folder. I have included this image in a header.jsp file and I have included header.jsp in the files hrms_user_login.jsp and hrms_default.jsp. The image in header.jsp is displayed in hrms_user_login.jsp, but not in hrms_default.jsp . I wonder why this happens.

This is how I included the image in header.jsp.

Can anyone kindly give a solution for this?

Any help in this regard is well appreciated.

Regards,
Anees
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please post some code describing how you have included the JSP file and how you are referring to the image ?

It is too early to comment but perhaps the relative URL of your image directory is causing a 404 when you are referring to the image. This is easy to spot in firefox. Right click on the page and click -> View page info. Go to the Media tag and check for broken image links. You can also use a debugger like Firebug to debug your web pages. It is very useful and can save you a lot of time.

You can get around your problem (if that indeed is the problem) by defining a HTML BASE element.
 
anees ahamed
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I call this hrms_header.jsp in the other jsp's as I told.

<td ><%@ include file="hrms_header.jsp" %></td>

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you notice that the image information didn't appear in your message?

The directory structure image doesn't help at all; there's no information in it regarding where the JSPs are located.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<td ><img /></td>
Not helpful.

Be sure to disable HTML when posting code.
 
anees ahamed
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The jsp's are those two(hrms_user_login.jsp and hrms_default.jsp) as shown in the application directory image.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you make it hard to help you, you'll get less help.

Chances are, your URLs to the images are not correct.
 
anees ahamed
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault,

I would be obliged to give whatever information you need to get a solution for this.
Kindly say, if I need to provide any other information.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seeing the URLs might help.
 
anees ahamed
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://localhost:8080/Application/hrms_user_login.jsp

http://localhost:8080/Application/servlet/server.hrms_user_login --> the page loaded is hrms_default.jsp. in this page, the image is not displayed in the common file header.jsp(the code for header.jsp I have given already, kindly refer)

 
anees ahamed
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For your kind reference,once again, the code of header.jsp

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I suspected, you are using page-relative URLs. That's a recipe for disaster in web apps. You need to use server-relative URLs. See the JSP FAQ for more info.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!