Hello all,
I'd like to pass a complex object (i.e. not a String or something easily convertible
to a String) to an actionForm, within an <html:form> tag.
Specifically, my jsp displays a list of BaseTable objects. I'd like to create an
<html:form> for each object, so that clicking on the "submit" button passes the given
object to my actionForm and calls the appropriate action. To make this clearer :
The <html:form> I'd *like* to have :
<html:form action="/detail.do">
<html:hidden property="element" value="<%=(BaseTable) element%>" />
<html:submit>
</html:form>
----------
My actionForm :
package com.wanadoo.es.dispatcher.forms;
//snip imports
import com.wanadoo.es.dispatcher.datastruct.BaseTable;
public class GetDetailForm extends ActionForm {
private BaseTable element;
//more...
//snip setters and getters
---------
The relevant struts-config.xml lines:
<form-bean name="detailForm" type="com.wanadoo.es.dispatcher.forms.GetDetailForm"/>
<action
path="/detail"
type="com.wanadoo.es.dispatcher.actions.GetDetailAction"
name="detailForm"
scope="request"
validate="false">
<forward name="Success" path="/detail.jsp"/>
</action>
The problem is that the <html:hidden> tags will only set String properties, and the
BaseTable object is too complex to be turned into a String and back.
I thought of making the actionForm bean available to the entire page, loading the
entire List of BaseTables into it statically, and only passing a String identifier
(such as the position of the object in the list, for instance) dynamically. However,
this would make for significant overhead (some lists have 500+ elements) and is
doesn't seem very elegant.
Any ideas ?
--
Laurent Leconte
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]