You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Murray, Christopher" <Ch...@ds-s.com> on 2002/10/31 12:26:33 UTC

with an ActionForm

I have an Arraylist of beans in a form with 2 attributes.  I wish to display
one of the attributes in a drop down list and the other I wish to submit in
the parent select tag when one of the elements is selected.

I am having trouble getting the options tag to retrieve the list from the
form and retrieve the attributes from   the beans.  When I use the
collections attribute in the options tag it refers to the list as a bean.

<form-bean name="myActionForm"
	type="com.<blah blah blah>.MyActionForm"/>

<action path="/<blah blah blah>/MySearch"
	type="com.<blah blah blah>.MyAction"
	name="myActionForm"
	scope="request"
	input="MyPage.jsp">
	<forward name="success" path="/<blah blah
blah>/NewPage.jsp"></forward>
</action>

<html:form method="post" action="/<blah blah blah>/MySearch">

	<html:select property="customerId">

	    <html:options collection="customerNameList" property="id"
labelProperty="name" />

	</html:select>

</html:form>

Where customerNameList is set in the form by the previous action.

	public List getCustomerNameList() {
		return customerNameList;
	}

	public void setCustomerNameList(List customerNameList) {

		this.customerNameList = customerNameList;
	}


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