Has someone out there successfully set the "selected" option of a
<html:select> under Struts 1.0?

What I try to do is to set the option as "selected" when "userId" matches
"shopWorkOrder.engineerId":
<bean:define id="eList" name="ShopWorkOrderFormBean"
property="engineerList"/>
<html:select property="shopWorkOrder.engineerId" >
   <html:options collection="eList" name="ShopWorkOrderFormBean"
property="userId" labelproperty="commonName"/>
</html:select>

I tried the following two things based on all your input but still can't get
it working:
Using optionsCollection  ----->
1) The following gave a compilation error claiming doesn't recognize
"optionsCollection".   I think this is a Struts 1.0 problem.
> <bean:define id="eList" name="ShopWorkOrderFormBean"
property="engineerList"/>
> <html:select property="shopWorkOrder.engineerId">
>    <html:optionsCollection  name="eList" value="userId"
label="commonName"/>
> </html:select>

Using value"<%=...%>"   ----->
2) The following also gave a compilation error that it doesn't like
value"<%=...%>"
> <bean:define id="eList" name="ShopWorkOrderFormBean"
property="engineerList"/>
> <html:select property="shopWorkOrder.engineerId"
value="<%=shopWorkOrder.engineerId%>">
>    <html:options collection="eList" name="ShopWorkOrderFormBean"
property="userId" labelproperty="commonName"/>
> </html:select>

I use debug statements inside the JSP to make sure there is a matching
userId:
> Eng id:<bean:write name="ShopWorkOrderFormBean"
property="shopWorkOrder.engineerId"/><br>
> <bean:define id="engrList" name="ShopWorkOrderFormBean"
property="engineerList"/>
> <logic:iterate id="element" name="engrList">
>  Label:<bean:write name="element" property="commonName"/>&nbsp;&nbsp;
>  Value:<bean:write name="element" property="userId"/><br><br>
> </logic:iterate>
>
> Here's the output from the above debug:
> Eng id:8
> Label:JOE ENGINEER XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXL   Value:3
> Label:VERLINDA BROOME   Value:NZW32M
> Label:FRANK WHITON   Value:NZ7Z1Q
> Label:Another Active Engineer   Value:8

Setting the "selected" in a <html:select> is a very basic operation.  I
can't see that being a bug in Struts 1.0.   But somehow it doesn't work. 
Has anyone done it successfully before???



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to