the way i would do it is this...

have your 3 pages.

each of those pages calls a "processing jsp/servlet" that
processes/validates/whateve  the form
also the bean info is saved either in the processor servlet or using the
<jsp:usebean > tags

the processor redirects you to the next page in the list which does the same
thing over again
with the next bunch of fields and then submits to the same processor (or a
different one if necessary)
and then redirects to the 3rd jsp page

yes, if the bean has a bunch of string fields, the saving can happen
automatically on submit

just make sure your bean has getter and setter methods for all the member
variables and make
sure they use the right naming convention   and that should do it.

hope this helps.

frank





John G Kroubalkian <[EMAIL PROTECTED]> on 11/10/99 10:05:45 AM

Please respond to John G Kroubalkian <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Frank Starsinic/TMS)

Subject:  Multi-Page Navigation Techniques?


Craig and all other JSP gurus,

Q1:  How do you handle page navigation for the multi-page input scenario?

Example:  A 3 page input layout
Page 1:  Has form for userFirstName, userLastName (separate Text Inputs)
Page 2:  Has form for homeStreetAddress, homeCity, homeState, homeZip
(separate Text Inputs)
Page 3:  Has form for homeTelAreaCode, homeTelNumber, emailAddress (separate
Text Inputs)

Q2:  So the Bean could have String fields representing each of the form
fields...3 separate forms.  Correct?

Q3:  Here's a possible bean class...still on the right track?
package com.mybeans;
/**
*  This bean holds all information to be used in forms
*  Each attribute (property) has an associated getter/setter pair
*/
public class UserInfoBean {

  public UserInfoBean() { //initialization...; }

  // Attributes/Members/Properties
  private String userFirstName;
  private String userLastName;
  ...
}

Q4:  Now for some .JSP to specify the bean.  This is placed at the very top of
the .JSP page and in effect tells the JSP engine "Try to locate a session bean
called "userinfo" of class "com.mybeans.UserInfoBean", if it does not exist,
construct a new bean using the default (no-args) constructor.  And, on
creation set the properties as specified by the included <jsp:setProperty...>
tags.
<-- Create the bean -->
<jsp:useBean id="userinfo" class="com.mybeans.UserInfoBean" scope="session">
// <==Session ok?
 <jsp:setProperty name="userinfo" property="userFirstName" value="" />
 <jsp:setProperty name="userinfo" property="userLastName" value="" />
 <jsp:setProperty name="userinfo" property="homeStreetAddress" value="" />
 <jsp:setProperty name="userinfo" property="homeStreetCity" value="" />
 <jsp:setProperty name="userinfo" property="homeStreetState" value="" />
 <jsp:setProperty name="userinfo" property="homeStreetZip" value="" />
 <jsp:setProperty name="userinfo" property="homeTelAreaCode" value="" />
 <jsp:setProperty name="userinfo" property="homeTelNumber" value="" />
 <jsp:setProperty name="userinfo" property="emailAddress"
value="[EMAIL PROTECTED]" />
</jsp:useBean>

Q5: Assuming a single .JSP is being hit, how do you deal with the page you're
on?  (In other words, there is a submit button on each page which points to
the .JSP page)

Q6:  And how do you prevent yourself from having to try to access each (and
every) form field on each pass through the page?

Q7:  What would be the impact of moving a field (say, emailAddress from page
3) to a different page (say page 2)?

Many Thanks,
John

(This is an excellent list!)

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to