GeeCON Prague 2014*
The moose likes Struts and the fly likes Image is not displaying after Submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Image is not displaying after Submit" Watch "Image is not displaying after Submit" New topic
Author

Image is not displaying after Submit

RaviSingh Kumar
Ranch Hand

Joined: Sep 04, 2007
Posts: 52
Hi,

I am new to struts. I have include Header.jsp page in my all jsp page(ex Login.jsp). In header.jsp page i have used <img> tag to include a bitmap image.
When Login.jsp page is accessed for the first time , Image is displayed, but when i submit with invalid name and password, the same login page is shown with validation errors. But this time the image is not shown. Instead a cross mark is displayed.

Please let me know if am missing something. Thanks in advance.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

Your Header.jsp must have a relative path to the image. So when the URL changes, the relative path stops working. Lets say the <img /> tag in your Header.jsp looks like this
<img src="images/header.jpg" />
Change it to
<img src="${pageContext.request.contextPath}/images/header.jpg" />


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
Don't get me started about those stupid light bulbs.
 
subject: Image is not displaying after Submit