You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Carter, Steve" <SC...@swiftrivers.com> on 2002/02/01 00:35:39 UTC

RE: bug with the select tag value attribute? - Solved somewhat

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
scarter@swiftrivers.com


-----Original Message-----
From: Maturo, Larry [mailto:larry_maturo@AthensGroup.com]
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
   lmaturo@athengroup.com




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>