Re: struts2 + s:select + freemarker

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Friday, November 20, 2009, 5:49:13 PM, falke2009 wrote:

>
> Hi,
>
> i have again a problem, i want to use <s:select/> component in my freemarker
> template. i see my list but any value wont be selected.
>
>  <@s.select theme="simple"
>                                         list="${component.list}"
> listKey="${component.listKey}" listValue="${component.listValue}"
>                                         value="${variableValue}"
> headerValue="-- select a property--" headerKey="-1" />
>
> as example:
>
> i have a list {a,b,c} and my variableValue is a. in this case a must be
> showed as selected. i see only my headerValue.

Are you aware of that in FreeMarker (JSP tag or nor) values are
normally NOT passed as

  paraName="${expression}"

but simply as

  paraName=expression

Unfortunately, "${expression}" happens to be a valid expression in
FreeMarker (it's a string literal, with an interpolation in it), so as
far as the expression can be converted to string it doesn't cause
error, but silently converts the expression to string. So maybe that's
the problem here too. (Also, with the same logic, with geaderKey="-1"
you specify the string "-1", not the number -1.)

> thanks in advance!

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.