You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Piers Dunleavy <pd...@ign.com> on 2003/06/24 23:07:20 UTC

Forms with dynamically generated fields

I have a JSP that generates a form based. The JSP creates a set of input
fields on fly based on some prior information that the user entered.
Therefore the number of fields for that form will differ from user to user.
What is the best approach in Struts for dealing with this. Obviously, I
can't simply define a DynaActionForm in the struts-config file, for there
won't be a fixed number of fields.

-Piers

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


Re: Forms with dynamically generated fields

Posted by Piers Dunleavy <pd...@ign.com>.
> You can always use mapped properties though.
>
> public String getSomeProperty(String parameter);
> public void setSomeProperty(String parameter, String value);

I take it, however, that there's no way of doing this simply through
DynaActionForm?

-Piers


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


Re: Forms with dynamically generated fields

Posted by Michael Thompson <Mi...@Sun.COM>.
You can always use mapped properties though.

public String getSomeProperty(String parameter);
public void setSomeProperty(String parameter, String value);

<html:text property="someProperty(yourKeyGoesHere)"/>  <!-- note the ()s -->

You might extract your keys from your form and loop over them with a c:forEach or a logic:iterate.

	--m

Piers Dunleavy wrote:
> I have a JSP that generates a form based. The JSP creates a set of input
> fields on fly based on some prior information that the user entered.
> Therefore the number of fields for that form will differ from user to user.
> What is the best approach in Struts for dealing with this. Obviously, I
> can't simply define a DynaActionForm in the struts-config file, for there
> won't be a fixed number of fields.
> 
> -Piers
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 



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