struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject freemarker radio tag with map literals [solved, kind of]
Date Thu, 13 Oct 2011 19:15:38 GMT
I'm having a hard time using the freemarker syntax radio tag.  This works fine:
< name="cars" list=[ "ford", "toyota" ] />

But using a literal map does not:
< name="cars" list={ "ford" : "mustang",  "toyota":"prius" } />

The web page renders:
"freemarker.ext.beans.HashAdapter$1$1$1@7e29d49f" as both the value and label.   I experimented
with various listValue parameters to no avail.

Other things I've tried that also don't work:

* Creating a map using OGNL syntax:  list="#{  ... }" -- FM chokes on the # -- "expecting
number" error
* using <@s.set name="carList" value="%{ #{ ... } }" />

If this is ever figured out it'd be great to note it in the examples section of this document:  (probably also the doc for select)

As well as mentioning freemarker map literal particulars on this document:

UPDATE -- After a few hours and checking of source code, I came up with this solution:

<#assign cars = {'ford':'Fusion', 'toyota':'Prius'} />
< name="cars" list=cars listKey="key" listValue="%{ getText( value ) }" />

I would have expected it to work without the listKey and listValue attributes.
If you have additional insight I'd love to hear it.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message