You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thomas Klute <kl...@klute-thiemann.de> on 2001/06/20 19:01:52 UTC

Subsessions needed?

Hi,

I have some problems finding the correct scope for my 
ActionFormBeans - 

I've splited one big form.jsp Page to several small
pages (formx.jsp, x=1,2,...), each page has a subset 
of the form-fields of form.jsp. I would like one
ActionFormBean to collect the data from these pages
and more than one "instance" of these pages in order
to create/modify more than one dataset.
The scope "request" for the actionformbean creates a
new bean with every request - impossible to collect the
data from more than one page.
The scope "session" creates one actionformbean per 
session - impossible to have more than one "instance"
of a form-page-set.

My indea was to create subsessions, but I think it's 
impossible without modifying struts code (f.e.
processActionForm() in ActionServlet.java).
I would like to keep struts code untouched - 
anybody has any indeas?

Thanks and regards,
 Thomas

Re: Subsessions needed?

Posted by Ted Husted <hu...@apache.org>.
I would try and put the big form into the session context myself, and
then update it from the sub forms as I go. When the workflow is
complete, and the record sets are updated, I'd remove the big form from
the session context.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/

Thomas Klute wrote:
> 
> Hi,
> 
> I have some problems finding the correct scope for my
> ActionFormBeans -
> 
> I've splited one big form.jsp Page to several small
> pages (formx.jsp, x=1,2,...), each page has a subset
> of the form-fields of form.jsp. I would like one
> ActionFormBean to collect the data from these pages
> and more than one "instance" of these pages in order
> to create/modify more than one dataset.
> The scope "request" for the actionformbean creates a
> new bean with every request - impossible to collect the
> data from more than one page.
> The scope "session" creates one actionformbean per
> session - impossible to have more than one "instance"
> of a form-page-set.
> 
> My indea was to create subsessions, but I think it's
> impossible without modifying struts code (f.e.
> processActionForm() in ActionServlet.java).
> I would like to keep struts code untouched -
> anybody has any indeas?
> 
> Thanks and regards,
>  Thomas

Re: Subsessions needed?

Posted by Mike Williams <mi...@cortexebusiness.com.au>.
  >>> On Wed, 20 Jun 2001 19:01:52 +0200,
  >>> "Thomas" == Thomas Klute <kl...@klute-thiemann.de> wrote:

  Thomas> The scope "request" for the actionformbean creates a
  Thomas> new bean with every request - impossible to collect the
  Thomas> data from more than one page.

How about if you propagate data thru the pages using hidden fields?  Note,
though, that this means passing lots more data back-and-forth between the
browser and server, and you'll have to re-validate the data for each
request.

  Thomas> The scope "session" creates one actionformbean per 
  Thomas> session - impossible to have more than one "instance"
  Thomas> of a form-page-set.

For each distinct multi-page "operation", you could generate a unique
operation ID (or call it a "sub-session ID", if you like).  Then, use the
op-ID as the key to store your ActionForm on the Session.  You'd need to
invoke ActionForm.validate() yourself within your action, as the ActionForm
would no longer have standard "name".  Plus, you might have to deal with
ActionForms for aborted operations littering your session.

-- 
Mike