• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts img tag?

 
Jessica Doe
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I had used the Struts img tag just cause I was trying to use and learn the Struts tags, e.g. <html:img page="/grafx/logo.jpg" width="150" height="140" alt="" />. But, now that I have deployed, I find it doesn't work for me. Apparently, it adds the jessionid onto the url (http://www.xxx.com/grafx/logo.jpg;jsessionid=49A25B81DEBD4EF7281DA6FA542BE796) which somehow interferes with fetching the image. I read about the tag online and in a book, but the descriptions were terse with no examples. So, I find I do not know the purpose or usage of the img (and, I suppose, similar tags like link).

1. Why doesn't the url with the appended jsessionid work?
2. When would you want the jsessionid appended?
2. How and when do you use img?

Thanks!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34860
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jessica Doe:

1. Why doesn't the url with the appended jsessionid work?
2. When would you want the jsessionid appended?
2. How and when do you use img?

1) I'm not sure of this one. Do links work? Maybe the server is getting confused about having a parameter with a simple image.
2) You would want the appended jsessionid if you are doing URL rewriting. This applies to cloned/clustered servers. URL rewriting is a way of having all of a single user's requests go to the same server. This can be useful for links, but not for images. An image is an images. It doesn't matter where it comes from.
3) I don't. It doesn't give me any value over the regular HTML tag. I suppose it could be used when your image is generated at runtime.
 
Jessica Doe
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thanks for the reply.

Apparently, it's not a Struts problem. According to the Struts Mailing List, with a server that has httpd in front of Tomcat with mod_jk or jk2, one solution is to upgrade to mod_jk2 (because mod_jk can't handle more than one wildcard match) and to add something like the following to the host setup (httpd.conf):

<Location "/images/*;jsessionid=*">
JkUriSet worker ajp13:localhost:8009
</Location>

This problem cannot occur with standalone Tomcat--perhaps on a development system--but, can show up when the application is deployed to a server using httpd -> mod_jk -> Tomcat.

(URLrewrite has similar functionality to mod_write).

Haven't tried it yet.

Ciao!

[ October 27, 2004: Message edited by: Jessica Doe ]
[ October 27, 2004: Message edited by: Jessica Doe ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic