• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html:image - strange!

 
A Patel
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to implement multiple form actions using Image Buttons and to display my image buttons on my JSP page, this is what I have:

<html:image property="addButton" src="AddDatabase.gif" alt="add" />
<html:image property="gotologinButton" src="GoToLogin.gif" alt="gotologin" />

This works fine. However I do not want my image files in the same directory as my JSP pages. So I create an images folder, throw my images in that directory and change my code as below:

<html:image property="addButton" src="/images/AddDatabase.gif" alt="add" />
<html:image property="gotologinButton" src="/images/GoToLogin.gif" alt="gotologin" />

This doesn't work. I also tried using back-slashes to show image path but that doesn't work either. Is this normal? How can I implement this?

Any help much appreciated.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A relative url must be relative to the browser's Address bar location, which may not be the same as your server's folder structure.
 
A Patel
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured it out. Instead of using src like in regular HTML, you use the page attribute to access relative images. Thanks to Aaron Johnson. He explains details in this article:

http://cephas.net/blog/2004/06/25/struts_tips_3.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic