You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Beeson, Ashley" <Be...@logica.com> on 2002/11/21 13:33:05 UTC

Html:select doesn't select correct element..

I have a problem with html:select not setting selected="selected" for the
correct item in a list of options. The weird thing is that it works fine for
all bar one of my pages.
 
I have checked that the property being passed in exists in the list of
options using a bean:write just above the html:select statement.
channelCommodity has the value of one of the elements 'code' in our
collection. 
 
A snippet of the code I'm using which doesn't work properly:
 
        <bean:define id="commodities" name="CHANNELEDITFORM"
property="commodityUnits" />
        <html:select size="1" property="channelCommodity">
        <html:options collection="commodities" property="code"
labelProperty="display"/>
        </html:select>
 
A snippet of the code I'm using which works correctly on another jsp page:
 
        <bean:define id="statuses" name="MEASURINGDEVICEEDITFORM"
property="energisationStatuses" />
        <html:select size="1" property="energisation">
            <html:options collection="statuses" property="code"
labelProperty="display"/>
        </html:select>
 
I should point out that there are no errors with the pages displayed apart
from the missing selected="selected" for the element that should be
selected.
 
This is using struts 1.0.2 and running on tomcat 4.0.4.
 
Any suggestions?
 
Cheers
____________________________
Ash Beeson - IT Consultant
email:  <ma...@logica.com> beesonas@logica.com
 


This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.