struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vaughan, Dallas" <VAUG...@scra.org>
Subject Indexed beans on a DynaValidatorActionForm
Date Wed, 21 Dec 2005 14:41:21 GMT
Hi,
Here is my (simplified) setup:

struts-config.xml:

<form-bean name="myForm" dynamic="true" type="org.apache.struts.action.DynaValidatorActionForm">
	<form-property name="name" type="java.lang.String"/>
	...
	<form-property name="lineItems" type="my.custom.LineItem[]"/>
</form-bean>

<action-mappings>
	<action path="/saveLineItem"
		name="myForm"
		type="my.package.SaveLineItemAction"
		validate="true"
		input="/displayOrder.do?method=afterError"
		scope="request">
		<forward name="success" path="order.edit"/>
	</action>
	
	<action path="/displayOrder"
		name="rfqForm"
		type="my.package.DisplayOrderAction"
		validate="false"
		scope="request"
		parameter="method">
		<forward name="successEdit" path="order.edit"/>
	</action>

...
</action-mappings>

"order.edit" is a tiles-def that allows user editing of the order, which, when constructed,
looks something like this:

<html>
<body>
<html:form action="/saveOrder.do" enctype="multipart/form-data" method="POST">
  ...
  <bean:define id="lineItems" name="myForm" property="lineItems"/>
  <logic:iterate name="lineItems" id="lineItem" type="my.custom.LineItem[]" indexId="itemIndex">
    <td><html:text name="lineItem" property="quantity" indexed="true" size="6"/></td>
    ...
  </logic:iterate>
</html:form>
</body>
</html>

The issue is, that if /saveLineItem is called and validation is successful, I can get the
parameter values off of the request (which is of type org.apache.struts.upload.MultipartRequestWrapper),
which include the lineItem property values.  However, if validation fails, there is no way
to get these values off the request before they are lost, since the DynaValidatorActionForm
doesn't support custom beans, and calling something like "request.getParameterValues("lineItem[0].property")
returns null.  Overriding the "reset()" method also doesn't allow me to get the request parameters.
 Why are the parameters getting lost?

Thanks,

Dallas Vaughan
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.1/206 - Release Date: 12/16/2005
 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message