struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kief Morris <>
Subject Re: URL encoding in <html:image> and <html:img> tags
Date Fri, 22 Jun 2001 10:18:01 GMT
DUBOIS Fabrice typed the following on 11:34 AM 6/22/2001 +0200
>I don't understand why Struts's <html:image> and <html:img> tags encodes GIF's
names with session's ID ? 
>I am using : 
>    * <html:image> tag with <html:form>  
>    * <html:img> tag with <html:link>  
>    * <html:img> standalone 
>in my JSP's pages. 
>For me, it seems to be useless to encode SRC attribute for those two tags since <html:form>
and <html:link> encodes ACTION and PAGE attribute with session's ID.
>In the third case (<html:img> standalone), I really don't understand why session's
ID is added to image path ??? 

The session ID is encoded into a URL so that, when the URL is loaded
by the client, the servlet engine knows which session the client belongs

The action encoding of the form is used when the form is submitted.
The URL encoding of the image is used when the image is loaded.
These happen at different times, on different requests, so having the form 
action URL encoded doesn't help the image URL. The same presumably
goes for the link - the image is loaded as a different request from the
one where the user clicks the link, so each needs to have the session
ID encoded separately.

So then the question may be, why does an image URL need to have
the session ID encoded into it - since images are static content, the
server shouldn't care what session it belongs to. The answer is that
not all images are static, some images are generated by servlets,
so struts needs to support encoding the URL.

Disclaimer: I'm a struts newbie, I may be missing something.


View raw message