• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image is not displaying after Submit

 
RaviSingh Kumar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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" />
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic