I think that 
I think the problem is with the dot notation. I found that something like the 
following works:
<bean:define    name      ="OrganizationForm"
                property  ="parentOrgId"
                id        ="parentOrgId"
                type      ="java.lang.String"/>
<html:select property="<%= parentOrgId %>" 
value="<%=parentOrgId %>"> 

This assumes OrganizationForm has a field parentOrgId of type String.

Is PARENT_ORG_ID a Constant in your form?


Steve Carter
Sr. Software Engineer
Swift Rivers
[EMAIL PROTECTED]


-----Original Message-----
From: Maturo, Larry [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 2002 3:17 PM
To: 'Struts Users Mailing List'
Subject: bug with the select tag value attribute? - Solved somewhat


I finally figured out what was wrong.

The below did not work:
<html:select property="<%= OrganizationForm.PARENT_ORG_ID %>" 
        
value="<%=OrganizationForm.PARENT_ORG_ID %>">
        <html:options collection="<%= Constants.ORG_LIST %>" 
                        property="<%= Constants.SELECT_VALUE %>"
                        labelProperty="<%= Constants.SELECT_LONG_NAME %>"/>
</html:select>

because value expects a constant, not a reference to a field in a form.

My solution was to put the value into the session in my action class,
thusly:
request.getSession().setAttribute(ORG_TYPE,orgType);

Then in the jsp I now have:
<html:select property="<%= OrganizationForm.PARENT_ORG_ID %>" 
   value="<%= (String)
request.getSession().getAttribute(EditOrganizationAction.PARENT_ORG_ID) %>">
   <html:options collection="<%= Constants.ORG_LIST %>" 
                                        property="<%= Constants.SELECT_VALUE
%>"
labelProperty="<%= Constants.SELECT_LONG_NAME %>"/>
</html:select>

This works, because the value is a string.  Now, the next question is, can I
do
this with the value stored in my form bean, instead of having to stuff it
into
the session (by the way, stuffing into the request did not work)?

-- Larry Maturo
   [EMAIL PROTECTED]




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


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

Reply via email to