struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "lei.java@gmail.com" <lei.j...@gmail.com>
Subject Re: Render preselected value in <s:select ../>
Date Fri, 28 Dec 2007 20:08:06 GMT
Thanks Al an Chris. Both work but in Chris's solution I have to use %{'02'}
in value attribute, like this:

<s:select lable="Months" name="months" headerKey="-1"
headerValue="Select Month" list="#{'01':'Jan','02':'Feb'}"
value="%{'02'}"/>
I'm not clear why? "%" is what syntax?

Thanks.


On Dec 28, 2007 2:35 PM, Chris Pratt <thechrispratt@gmail.com> wrote:

> Try:
> <s:select lable="Months" name="months" headerKey="-1"
> headerValue="Select Month" list="#{'01':'Jan','02':'Feb'}"
> value="02"/>
>
> What the original code was doing was calling getSelectedMonth() on the
> value stack (usually a method on the Action) and using that value to
> pre-select the proper month.
>  (*Chris*)
>
>
> On Dec 28, 2007 11:28 AM, lei.java@gmail.com <lei.java@gmail.com> wrote:
> > Hi all,
> >
> > This struts code
> >
> > <s:select lable="Months" name="months" headerKey="-1"
> headerValue="Select
> > Month" list="#{'01':'Jan','02':'Feb'}" value="selectedMonth"/>
> >
> > generates this html code:
> >
> > <select name="months" id="edit_months">
> >     <option value="-1">Select Month</option>
> >     <option value="01">Jan</option>
> >     <option value="02">Feb</option>
> > </select>
> >
> > If I want "Feb" is selected (<option value="02" selected>Feb</option>),
> how
> > to do it in the <s:select .../>?
> >
> > Many thanks.
> >
>
>  ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message