aspose file tools*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 9280
    
  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
 
Consider Paul's rocket mass heater.
 
subject: Image is not displaying after Submit
 
Similar Threads
Image not dispalyed in one JSP but dispalyed in other
Include Jsp in Jsp
asynchronous inclusion of jsp pages using include directive and RequestDispatcher
Unable to forward page to login.jsp
A jsp deployment problem