开发者

simple OGNL projection required in struts2

I would like to create a really simple tag parameterized with a collections' ids something like the following:

<s:url action="theaction" namespace="/" includeParams="all" id="histURL">
 <s:param name="sources" value="sources.{id}"></s开发者_StackOverflow中文版:param>
</s:url>
${histURL}

If I have say three Source objects defined in my Action class, having ids 1,2 and 3 then I assume, the histURL output will be sg like:

http://localhost:8080/myproject/theaction&sources=1&sources=2&sources=3

But it does not work, it displays:

http://localhost:8080/myproject/theaction

Another hint:

<s:url action="theaction" namespace="/" includeParams="all" id="histURL">
 <s:param name="sources" value="sources"></s:param>
</s:url>
${histURL}

results in

http://localhost:8080/myproject/theaction&sources=com.mycompany.Source@32324&sources= ...

So the collection as a paramater works, I just assumed that the OGNL projection works well but seems to be buggy. Or am I missing something? Is this OGNL at all? :)

Thank you for your replies!


I'm dumb. This is just the way, I missed that I used a wrong class, which had no Id at all. It's definitely OGNL and it works like charm :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜