Java Mailing List Archive

http://www.junlu.com/

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

Struts session scoped forms

Chaudhary, Harsh

2007-02-28

Replies:

I have page1.jsp which has a form which calls Page1Action which forwards
to page2.jsp. Also, session scoped Page1Form and Page2Form.

In Page1Action, I do:

Page2Form frm = new Page2Form();
frm.setSomeVariable("Some Value");

Then read this value in page2.jsp to display.

I feel the bad part is initializing the Page2Form myself. This works
correctly because I think Struts checks for the form being available in
all scopes, finds it in session, and just uses that instead of creating
a new one in the Page2Form constructor.

Is this way of doing things correct? If not why? Or am I zoned out too
much to make sense?

Rehards,
Harsh.

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

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