The reason you see 'selected="selected"' is for XHTML compatibility. In
XHTML (and XML) a value must always be specified for an attribute, so you
can't just say 'selected'. The spec states that, in cases like this, the
value should be the same as the attribute name. Hence 'selected="selected"',
'multiple="multiple"', etc.
--
Martin Cooper
----- Original Message -----
From: "Simon Liang" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 19, 2001 4:41 PM
Subject: RE: Options tag - 'selected'
> Got it, while going throught search of old mailing list emails.
>
> <html:select name="userprofileForm" property="preferredLanguage"
> value="en_uk">
> <html:options collection="languageTypes" property="value"
> labelProperty="label"/>
> </html:select>
>
> But look at what it produces:(instead of just 'selected', it's outputted
> twice?????)
>
> <select name="preferredLanguage">
> <option value="en_us">English</option>
> <option value="en_uk" selected="selected">British English</option>
> </select>
>
>
> -----Original Message-----
> From: Simon Liang
> Sent: Tuesday, June 19, 2001 4:19 PM
> To: [EMAIL PROTECTED]
> Subject: Options tag
>
>
> Hi All:
>
> I don't know if i am doing something wrong or not. Either i am really
stupid
> or i am totally misunderstanding something here - as i have tried for the
> last serveral hrs getting options tag to output the 'selected' text in
html.
>
> I basically followed the example(subscription.jsp) on this, but couldn't
> figure out why it's not outputting 'selected' as the example claims is
> working.
>
> <!-----------------------------------------------here is the jsp -->
> <%
> java.util.ArrayList list = new java.util.ArrayList();
> list.add(new com.vns.um.struts.LabelValueBean("English", "en_us"));
> list.add(new com.vns.um.struts.LabelValueBean("British English",
> "en_uk"));
> pageContext.setAttribute("languageTypes", list);
> %>
>
> <html:form action="/saveProfile">
> <HR>
> <TR>
> <td><html:text name="userprofileForm" property="uid" size="10"
> maxlength="10"/></TD>
> <td><html:text name="userprofileForm" property="password" size="10"
> maxlength="10"/></TD>
> <td><html:text name="userprofileForm" property="firstName" size="10"
> maxlength="10"/></TD>
> </tr>
> <tr>
> <html:select name="userprofileForm" property="preferredLanguage" >
> <html:options collection="languageTypes" property="value"
> match="en_uk"
> labelProperty="label"/>
> </html:select>
> </tr>
> </html:form>
>
> How do i get "en_uk" selected????? Thanks for any help.
>
> Simon
>
>
>
>
>
============================================================================
> This message is intended only for the use of the Addressee(s) and may
> contain information that is PRIVILEGED and CONFIDENTIAL. If you are not
> the intended recipient, dissemination of this communication is prohibited.
> If you have received this communication in error, please erase all copies
> of the message and its attachments and notify [EMAIL PROTECTED]
> immediately.
>
============================================================================
>
>
>
============================================================================
> This message is intended only for the use of the Addressee(s) and may
> contain information that is PRIVILEGED and CONFIDENTIAL. If you are not
> the intended recipient, dissemination of this communication is prohibited.
> If you have received this communication in error, please erase all copies
> of the message and its attachments and notify [EMAIL PROTECTED]
> immediately.
>
============================================================================
>