You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paul <pa...@merge-solutions.com> on 2007/05/11 14:40:43 UTC

[S2] tag & pre-selected options

Hi all,
 
Could someone please a quick example on how to pre-select options within an <s:select> tag?
 
I have a user edit form where I have an <s:select multiple="true"> list which is populated with all the user roles in the system.
 
Obviously when editing a user, I'd like to cross reference against the "Set" of roles the user belongs to already inside the loaded UserModel that is being edited? Where should I be looking for this information or could someone kindly provide an example?
 
Regards,
P

RE: [S2] tag & pre-selected options

Posted by Paul <pa...@merge-solutions.com>.
So based on the last example there,

<s:select label="Months"
       name="months"
       headerKey="-1" headerValue="Select Month"
       list="#{'01':'Jan', '02':'Feb', [...]}"
       value="selectedMonth"
       required="true"
/>

// The month id (01, 02, ...) returned by the getSelectedMonth() call
// against the stack will be auto-selected


I'd just do something like,

list = "#roleAction.roles"
value="user.roles"

etc?

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Nate Drake
Sent: Friday, May 11, 2007 8:55 AM
To: user@struts.apache.org
Subject: Re: [S2] <s:select> tag & pre-selected options

http://struts.apache.org/2.x/docs/select.html




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




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


Re: [S2] tag & pre-selected options

Posted by Nate Drake <nd...@gmail.com>.
http://struts.apache.org/2.x/docs/select.html




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