Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: Struts session scoped forms

Michael J.

2007-02-28

Replies:

On 2/28/07, Frank W. Zammetti <fzlists@(protected):
> I'm not sure what your proposing is bad per se... let's ask it this way:
> how else could you accomplish this without manually instantiating the
> form, because I agree, that's the one part that doesn't smell great to
> me either.
>
> One way to do it would be that the forward returned from Page1Action
> specifies not a JSP directly, but instead some "setup" action mapping
> for page2. It would have the session-scoped form mapping, so Struts
> would create it if necessary, and the action could then do the necessary
> populating that page2.jsp requires.
>
> That's probably a somewhat cleaner approach, but it has the down side of
> invoking the whole request processing cycle again, so there is an
> overhead involved. Bit of a trade-off.

Right. I forgot that the forms are session-scoped, so form data will
not be lost on redirect. Also, request parameters will be cleared on
redirect, so the second form will not be populated from data of the
first request.

See this page then for some ideas:
http://wiki.apache.org/struts/StrutsManualActionClasses

I prefer to submit HTML forms to the same action that renders a page,
this allows to cleaner separate actions.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.