You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jonny Cavell <jo...@gmail.com> on 2008/03/05 13:17:25 UTC

Struts 2 + Freemarker - how to set a select list option to selected from a request param

If I set a request param with ?professionId=3, this does not make the
professionId with value 3 selected. What am I doing wrong?

...
<@s.select name = "professionId" key="profession"
                    headerKey="" headerValue="select_profession"
                    list="professions"
                     listKey="id"
       listValue="name"
       value = "%{#parameters.professionId}"
                    required="true"
 />
...
-- 
View this message in context: http://www.nabble.com/Struts-2-%2B-Freemarker---how-to-set-a-select-list-option-to-selected-from-a-request-param-tp15848645p15848645.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2 + Freemarker - how to set a select list option to selected from a request param

Posted by Laurie Harper <la...@holoweb.net>.
Jonny Cavell wrote:
> If I set a request param with ?professionId=3, this does not make the
> professionId with value 3 selected. What am I doing wrong?
> 
> ....
> <@s.select name = "professionId" key="profession"
>                     headerKey="" headerValue="select_profession"
>                     list="professions"
>                      listKey="id"
>        listValue="name"
>        value = "%{#parameters.professionId}"
>                     required="true"
>  />
> ....

What does the 'professions' property of your action contain? What type 
is the 'professionId' property of your action? And what does the 
generated HTML look like? My guess would be that you have a type 
mis-match between action.professionId and action.professions[#].id.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org