You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Franck Lefebure <fl...@orange.gp> on 2003/05/15 20:35:49 UTC
RE : ActionForm with Indexed Properties
Hi,
Finally, the way I feel the best is to put
the form in session scope when I create/modify it
and to get it from the session in the reset() method
I was inspired with the war example found here
http://keyboardmonkey.com/downloads/index.jsp
Franck
> -----Message d'origine-----
> De : Rick Reumann [mailto:r@reumann.net]
> Envoyé : lundi 12 mai 2003 17:47
> À : struts-user@jakarta.apache.org
> Objet : Re: ActionForm with Indexed Properties
>
>
> On Mon, 12 May 2003 16:54:00 -0400, Franck Lefebure wrote:
>
> >
> > This exception seems to appear after the call of the reset method
> > Actually, the only workaround I found is to increment/decrement a
> > session variable with the Number of items in the itemList and to
> > manually instantiate the items in the reset method :
> >
> > int indexMax =
> > ((Integer)httpSession.getAttribute("indexMax")).intValue();
> > if (itemList.size() != indexMax) {
> > for (int index=0; index<indexMax; index++)
> > itemList.add(new InfoCineFormBean());
> >
> > But I feel this really crappy
> >
> > Is there a better way to have dynamic number of field in an
> actionform
> > ?
>
> I've run into this before, and I end up sort of
> cheating and giving these kinds of things session scope. My
> guess is you are using request scope, which normally is fine,
> but when you end up having Collections you often run into the
> problem you're seeing. To me it's just easier to use session
> scope for these situations vs having to make sure the List is
> prepopulated with enough objects to avoid the situation you
> are describing. Let me know what you end up deciding to do.
>
> --
> Rick
>
>
>
> ---------------------------------------------------------------------
> 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