You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ni...@uk.pwcglobal.com on 2001/01/29 18:54:44 UTC

Multi-page forms


Memo from Nic Hobbs of PricewaterhouseCoopers

-------------------- Start of message text --------------------

Hi all,

The struts user guide
(http://jakarta.apache.org/struts/userGuide/building_model.html#actionform) says
the following:

"You should note that a "form", in the sense discussed here, does not
necessarily correspond to a single JSP page in the user interface.
It is common in many applications to have a "form" (from the user's perspective)
 that extends over multiple pages. Think, for example, of the
wizard style user interface that is commonly used when installing new
applications. Struts encourages you to define a single ActionForm bean
that contains properties for all of the fields, no matter which page the field
is actually displayed on. Likewise, the various pages of the same
form should all be submitted to the same Action Class. If you follow these
suggestions, the page designers can rearrange the fields among
the various pages, with no changes required to the processing logic in most
cases. "

How does struts know when all the beans attributes have been set across a
multi-page form and therefore when to call perform()? Or is this the
 responsibility of the validate() method to decide and forward on to the next
page if necessary? If the latter is the case how can this be
independant of the view? I.e. If the page developers can change the order of the
 fields across multiple pages, how does the Form Bean developer
know at any point which page the user is on and therefore where to forward them
to next?

Any help in clarifying this for me would be greatly appreciated!

Keep up the good work!

Nic

--------------------- End of message text --------------------

The principal place of business of PricewaterhouseCoopers and its associate
partnerships is 1 Embankment Place, London WC2N 6NN where lists of the
partners' names are available for inspection. All partners in the associate
partnerships are authorised to conduct business as agents of, and all
contracts for services to clients are with, PricewaterhouseCoopers. The UK
firm of PricewaterhouseCoopers is authorised by the Institute of Chartered
Accountants in England and Wales to carry on investment business.
PricewaterhouseCoopers is a member of the world-wide
PricewaterhouseCoopers organisation.
----------------------------------------------------------------
The information transmitted is intended only for the person or entity to which
it is addressed and may contain confidential and/or privileged material.  Any
review, retransmission, dissemination or other use of, or taking of any action
in reliance upon, this information by persons or entities other than the
intended recipient is prohibited.   If you received this in error, please
contact the sender and delete the material from any computer.



RE: Multi-page forms

Posted by Carl Tallis <ct...@supplylinks.com>.
Nic -

	I got a sample of a multi-page to work by using the action to tell the form
object which validation should occur:

   <action     path="/createOrderItems"
      actionClass="com.supplylinks.app.CreateOrderAction">
    <property name="formAttribute" value="orderForm"/>
    <property name="formClass"
             value="com.supplylinks.app.OrderForm"/>
    <property name="inputForm"     value="/createOrderLocations.jsp"/>
    <forward  name="success"
path="/createOrderItems.jsp?action=EditItems"/>
    <forward  name="failure"        path="/mainMenu.jsp"/>
  </action>
  <action     path="/createOrderShippingOptions"
       actionClass="com.supplylinks.app.CreateOrderAction">
    <property name="formAttribute" value="orderForm"/>
    <property name="formClass"
             value="com.supplylinks.app.OrderForm"/>
    <property name="inputForm"     value="/createOrderItems.jsp"/>
    <forward  name="success"
path="/createOrderShippingOptions.jsp?action=EditShipping"/>
    <forward  name="failure"        path="/mainMenu.jsp"/>
  </action>


This is two of the "pages" of a multi-page order form, all of which use the
same back-end form and action classes.  The validation does a switch based
on the action; inelegant, perhaps, but simple and effective.  This keeps the
navigation "knowledge" centralized in the action.xml file.

Carl Tallis
Director Of Products
SupplyLinks, Inc.
Tel: (703) 796-6010
Fax: (703) 796-6014
email: CTallis@SupplyLinks.com <ma...@SupplyLinks.com>



> -----Original Message-----
> From: nic.hobbs@uk.pwcglobal.com [mailto:nic.hobbs@uk.pwcglobal.com]
> Sent: Monday, January 29, 2001 12:55 PM
> To: struts-user@jakarta.apache.org
> Subject: Multi-page forms
>
>
>
>
> Memo from Nic Hobbs of PricewaterhouseCoopers
>
> -------------------- Start of message text --------------------
>
> Hi all,
>
> The struts user guide
> (http://jakarta.apache.org/struts/userGuide/building_model.html#ac
> tionform) says
> the following:
>
> "You should note that a "form", in the sense discussed here, does not
> necessarily correspond to a single JSP page in the user interface.
> It is common in many applications to have a "form" (from the
> user's perspective)
>  that extends over multiple pages. Think, for example, of the
> wizard style user interface that is commonly used when installing new
> applications. Struts encourages you to define a single ActionForm bean
> that contains properties for all of the fields, no matter which
> page the field
> is actually displayed on. Likewise, the various pages of the same
> form should all be submitted to the same Action Class. If you follow these
> suggestions, the page designers can rearrange the fields among
> the various pages, with no changes required to the processing
> logic in most
> cases. "
>
> How does struts know when all the beans attributes have been set across a
> multi-page form and therefore when to call perform()? Or is this the
>  responsibility of the validate() method to decide and forward on
> to the next
> page if necessary? If the latter is the case how can this be
> independant of the view? I.e. If the page developers can change
> the order of the
>  fields across multiple pages, how does the Form Bean developer
> know at any point which page the user is on and therefore where
> to forward them
> to next?
>
> Any help in clarifying this for me would be greatly appreciated!
>
> Keep up the good work!
>
> Nic
>
> --------------------- End of message text --------------------
>
> The principal place of business of PricewaterhouseCoopers and its
> associate
> partnerships is 1 Embankment Place, London WC2N 6NN where lists of the
> partners' names are available for inspection. All partners in the
> associate
> partnerships are authorised to conduct business as agents of, and all
> contracts for services to clients are with, PricewaterhouseCoopers. The UK
> firm of PricewaterhouseCoopers is authorised by the Institute of Chartered
> Accountants in England and Wales to carry on investment business.
> PricewaterhouseCoopers is a member of the world-wide
> PricewaterhouseCoopers organisation.
> ----------------------------------------------------------------
> The information transmitted is intended only for the person or
> entity to which
> it is addressed and may contain confidential and/or privileged
> material.  Any
> review, retransmission, dissemination or other use of, or taking
> of any action
> in reliance upon, this information by persons or entities other than the
> intended recipient is prohibited.   If you received this in error, please
> contact the sender and delete the material from any computer.
>
>
>
>