Thanks a lot Chris. I'm sorry I have read it as double double quotes. Your
explaination and solution are great!

Thanks again.

On Dec 28, 2007 3:28 PM, Chris Pratt <[EMAIL PROTECTED]> wrote:

> Not double quotes, single quotes.  basically here's an expanded view
> of what I meant, (you should remove all the spaces before you try it):
>  value="  '  02  '  ".  If you use value="  "  02  "  ", then the JSP
> processor reads it as an empty value folowed by some gibberish that it
> doesn't understand, so you have to wrap the literal value in single
> quotes, then wrap that in the double quotes required by HTML.  Does
> that make sense?  For that matter, if value="${'02'}" is working for
> you, there's nothing wrong with it.
>  (*Chris*)
>
> On Dec 28, 2007 12:24 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Hi Chris,
> >
> > I tried value="02" but it didn't work. I also tried value=""02"" and got
> an
> > error.
> >
> > You mentioned two double quotes. Is that on purpose?
> >
> > Thanks.
> >
> >
> > On Dec 28, 2007 3:13 PM, Chris Pratt <[EMAIL PROTECTED]> wrote:
> >
> > > I think you could also use:
> > >
> > > value="'02'"
> > >
> > > (notice the extra single quotes).  Since the tags evaluate the value
> > > as an OGNL expression, they look for a get02() instead of recognising
> > > it as a literal value, using '02' instead of 02 tells the OGNL
> > > processor it's a literal value.  The %{} is called alternate syntax
> > > and it's used to make it more obvious that the value is an OGNL
> > > expression, since you had not only used the alternate syntax, but also
> > > added the single quotes everything started working.  Sorry for the
> > > confusion, that's what I get for trying to help without checking my
> > > work.
> > >  (*Chris*)
> > >
> > > On Dec 28, 2007 12:08 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> wrote:
> > > > 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 <[EMAIL PROTECTED]>
> 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, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> > > 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: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to