Hi Maurice,

You can store all the field input (for all 3 forms) in one class (a java
bean).

eg.

public Class FormData {
  private String x
  private String y
  private etc....

  each instance variable would have a getXXX, and setXXX method
}

At form1, have your servlet create and populate the bean with the form1
data.  Then put
the bean in your HttpSession.

eg.
FormData formData = new formData();
formData.setFirstName(req.getParameter("FirstName"));
session.setAttribute("myFormData", formData);

At form2, grab that bean back and fill in form2.  Same for form3.
eg.
FormData formData = (FormData)session.getAttribute("myFormData");
formData.setLastName(req.getParameter("LastName"));

When you want to display the results to the user, take the bean out of
HttpSession and use it
to fill in the values.

eg.  Assuming your servlet did the form processing and put the formData bean
in the HttpSession, your JSP would
then do the following:

<jsp:useBean id="myFormData" scope="session"
class="com.MyCompany.form.formAdapter.FormData" />

Form 1 results are:
First Name: <%=myFormData.getFirstName %>

Form 2 results are:
Last Name: <%=myFormData.getLastName %>

Possible problems with this approach are:
1.  If your 3 forms have a lot of input, then you would have one big java
bean.  Personally, I'm will to accept that for the
beneift of less complexity in having to have a form data bean for each form
(eg. Form1DataBean, Form2DataBean, Form3DataBean).

2.  Your FormData bean can't tell you which of it's fields came from form1,
form2 or form3.  The formData bean doesn't need to
know.  If you look at the above JSP example, for each section (eg. Form 1
results are:, Form 2 results are:) you still
need to put a JSP tag to extract out the appropriate data.

Albert


-----Original Message-----
From: Maurice Coyle - Sun ireland - Software Products and Platforms -
Internationalization Engineer [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 28, 2000 4:00 AM
To: [EMAIL PROTECTED]
Subject: form processing


hi,
say if i have a number of forms, f1, f2, etc...

i am trying to have my application in such a way that a user can fill out
f1,
click submit, fill out f2, click submit, and so on.  when they have
completed
all (or some, it shouldn't matter) of the forms, i would like to be able to
display all of the results of the forms they have filled out on one html
page.
that is, the html results page would be like this:

f1 results:

result f1a.
result f1b.
result f1c.

f2 results:

result f2a.
result f2b.
result f2c.

and so on......

i hope someone can help and i will greatly appreciate any feedback.

thanks very much,
maurice

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
  • ... Maurice Coyle - Sun ireland - Software Products and Platforms - Internationalization Engineer
    • ... Jamel Tayeb
    • ... Albert Wong
    • ... Willy LEGIMAN
    • ... Anabathula Jagadeesh
    • ... Sanjib Biswas
      • ... Daniel Bergenhus
    • ... Sachin S. Khanna
    • ... Hoorn, Michiel van
      • ... Mayuresh Kadu
    • ... Daniel Bergenhus
      • ... Dheil Corona

Reply via email to