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