home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Sample.bin
/
PHCardEntry.java
< prev
next >
Wrap
Text File
|
1998-10-17
|
2KB
|
83 lines
package symantec.sourcebook.creditcheck;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class PHCardEntry extends PageHandler
{
private final static String PAGENAME = PAGEBASE + "cardentry.html";
int pagenumber = CreditCheck.SUCCESS_PAGE_NUM;
public PHCardEntry()
{
}
public String pageName()
{
return PAGENAME;
}
public int nextPage()
{
return pagenumber;
}
protected void customize(Object pageDataObject) throws IOException
{
PageData pageData = (PageData) pageDataObject;
String orderInformation = "Name : "+ pageData.ccName + "<br>" +
"Total: " + pageData.ccTotal + "<br>" ;
String fieldText = "<input type=\"hidden\" name=\"successCGI\" value=\""+ pageData.successCGI +"\"> ";
fieldText += orderInformation + "<input type=\"hidden\" name=\"ccTotal\" value=\""+pageData.ccTotal+"\">";
fieldText += "<input type=\"hidden\" name=\"ccName\" value=\""+pageData.ccName+"\">";
fieldText += "<input type=\"hidden\" name=\"orderId\" value=\""+pageData.orderId+"\">";
insert("fieldPosition",fieldText);
if(pageData.messageText != null) insert("posErrorText",pageData.messageText);
}
public Object validate(ServletConfig config,HttpServletRequest request,HttpServletResponse response)
{
PageData pageData = new PageData(config,request,response);
String errorText = "";
// get information from the form
pageData.ccName = getParameter(request,"ccName","");
pageData.ccTotal = getParameter(request,"ccTotal","");
pageData.ccNumber = getParameter(request,"ccNumber","");
pageData.successCGI = getParameter(request,"successCGI","");
pageData.orderId = getParameter(request,"orderId","");
// do some sanity checks
if(pageData.ccNumber.length() < 2) errorText += "Please enter card number<br>";
// if it looks bad, bail
if(errorText.length() > 0)
{
pagenumber = CreditCheck.CARDENTRY_PAGE_NUM;
pageData.messageText = errorText;
return pageData;
}
return pageData;
}
}