Strutsのhtmlタグ+mayaaでハマった
商品一覧画面とかで商品画像を表示する場合、mayaaファイルで
<?xml version="1.0" encoding="Shift_JIS"?> <m:mayaa xmlns:m="http://mayaa.seasar.org" xmlns:html="http://struts.apache.org/tags-html" xmlns:bean="http://struts.apache.org/tags-bean" xmlns:logic="http://struts.apache.org/tags-logic" m:noCache="true"> : <logic:iterate m:id="shoppinglist" id="list" name="cart" indexId ="index" property="returnList" type="example.cart"/> : <html:img m:id="img" src="/path/to/images/${list.image}"/> : </m:mayaa>
という具合にStrutsのhtmlタグを使用していたところ、最初のアクセス時だけ、生成されたimgタグに「;jsessionid=...」が。。。マズイっ!access_logにセッションID登録ですかっ!ちなみに、formタグで同様でした。
ということで、
: <img m:id="img" src="/path/to/images/${list.image}"/> :
として、素のimgタグにすることで解決。あるいは、
: <m:echo m:id="img"> <m:attribute name="src" value="/path/to/images/list.image}" /> </m:echo> :
として、属性の値だけを変えてもOKでした。ちゅーか、mayaaファイルにそのままタグ書いてもOKなんですね。
しかし、いくらServletの仕様といえど、ありえんっ! > htmlタグ