home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Sample.bin
/
PHEnterInfo.java
< prev
next >
Wrap
Text File
|
1998-09-13
|
2KB
|
71 lines
package symantec.sourcebook.servlet;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class PHEnterInfo extends PageHandler
{
private final static String PAGENAME = PAGEBASE + "enterinfo.html";
int pagenumber = ESDServlet.VERIFYINFO_PAGE_NUM;
public PHEnterInfo()
{
}
public String pageName()
{
return PAGENAME;
}
public int nextPage()
{
return pagenumber;
}
public Object validate(ServletConfig config,HttpServletRequest request,HttpServletResponse response)
{
PageData pageData = new PageData(config,request,response);
String errorText = "";
// get information from the form
String name = getParameter(request,"name","");
String email = getParameter(request,"email","");
String address= getParameter(request,"address","");
String city = getParameter(request,"city","");
String company= getParameter(request,"company","");
String state = getParameter(request,"state","");
String country= getParameter(request,"country","");
String zip = getParameter(request,"zip","");
String phone = getParameter(request,"phone","");
// do some sanity checks
if(name.length() < 2) errorText += "Please enter your full name in the name field<br>";
if(email.length() < 5) errorText +="Your e-mail address is required. (It will not be sold to spammers)<br>";
if(address.length() < 2)errorText += "Please provide your full mailing address<br>";
if(city.length() < 2) errorText +="Please include a city in your address<br>";
// if it looks bad, bail
if(errorText.length() > 0)
{
pagenumber = ESDServlet.ENTERINFO_PAGE_NUM;
pageData.messageText = errorText;
return pageData;
}
// create a new transaction
pageData.transaction = new Transaction(name,email,address,city,company,state,country,zip,phone);
return pageData;
}
}