实在 “New Account”时,我提交了用户信息提示如上错误的: NewUserAction.java的代码如下: /** * Copyright (c) 1996-2003 Borland Software Corporation. All Rights Reserved. * * This SOURCE CODE FILE, which has been provided by Borland Software as part * of a Borland Software product for use ONLY by licensed users of the product, * includes CONFIDENTIAL and PROPRIETARY information of Borland Software. * * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH * THE PRODUCT. * * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND SOFTWARE, ITS * RELATED COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY * CLAIMS OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR * DISTRIBUTION OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES * ARISING OUT OF OR RESULTING FROM THE USE, MODIFICATION, OR * DISTRIBUTION OF PROGRAMS OR FILES CREATED FROM, BASED ON, AND/OR * DERIVED FROM THIS SOURCE CODE FILE. */ package com.borland.samples.esite.web;import org.apache.struts.action.*; import javax.servlet.http.*; import com.borland.dx.ejb.*;public class NewUserAction extends Action { public ActionForward perform(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { // Extract attributes we will need SessionBean sessionBean = (SessionBean) httpServletRequest.getSession().getAttribute("sessionBean"); NewUserForm userForm = (NewUserForm) actionForm; String password = userForm.getPassword(); String confirmPassword = userForm.getConfirmpassword(); if ( !password.equals(confirmPassword) ) { httpServletRequest.setAttribute("message", "Password does not match"); return (new ActionForward(actionMapping.getInput())); } else if ( password.length() == 0 ) { httpServletRequest.setAttribute("message", "You must specify a password"); return (new ActionForward(actionMapping.getInput())); } else { String username = userForm.getUsername(); String firstname = userForm.getFirstname(); String lastname = userForm.getLastname(); String address = userForm.getAddress(); String city = userForm.getCity(); String state = userForm.getState(); String zip = userForm.getZip(); EjbClientDataSet dataSet = sessionBean.getClientDataModule().getUserDataSet(); dataSet.insertRow(false); dataSet.setString("Username", username); dataSet.setString("Firstname", password); dataSet.setString("Lastname", firstname); dataSet.setString("Address", lastname); dataSet.setString("City", address); dataSet.setString("State", city); dataSet.setString("Zip", state); dataSet.setString("Password", zip); dataSet.post(); if ( sessionBean.addUser(username, password) ) { userForm.reset(actionMapping, httpServletRequest); return (actionMapping.findForward("welcome")); } else { dataSet.deleteRow(); httpServletRequest.setAttribute("message", "Username aleady exists."); return (new ActionForward(actionMapping.getInput())); } } } }
NewUserAction.java的代码如下:
/**
* Copyright (c) 1996-2003 Borland Software Corporation. All Rights Reserved.
*
* This SOURCE CODE FILE, which has been provided by Borland Software as part
* of a Borland Software product for use ONLY by licensed users of the product,
* includes CONFIDENTIAL and PROPRIETARY information of Borland Software.
*
* USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
* OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
* THE PRODUCT.
*
* IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND SOFTWARE, ITS
* RELATED COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY
* CLAIMS OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR
* DISTRIBUTION OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES
* ARISING OUT OF OR RESULTING FROM THE USE, MODIFICATION, OR
* DISTRIBUTION OF PROGRAMS OR FILES CREATED FROM, BASED ON, AND/OR
* DERIVED FROM THIS SOURCE CODE FILE.
*/
package com.borland.samples.esite.web;import org.apache.struts.action.*;
import javax.servlet.http.*;
import com.borland.dx.ejb.*;public class NewUserAction extends Action {
public ActionForward perform(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
// Extract attributes we will need
SessionBean sessionBean = (SessionBean) httpServletRequest.getSession().getAttribute("sessionBean");
NewUserForm userForm = (NewUserForm) actionForm;
String password = userForm.getPassword();
String confirmPassword = userForm.getConfirmpassword();
if ( !password.equals(confirmPassword) ) {
httpServletRequest.setAttribute("message", "Password does not match");
return (new ActionForward(actionMapping.getInput()));
}
else if ( password.length() == 0 ) {
httpServletRequest.setAttribute("message", "You must specify a password");
return (new ActionForward(actionMapping.getInput()));
}
else {
String username = userForm.getUsername();
String firstname = userForm.getFirstname();
String lastname = userForm.getLastname();
String address = userForm.getAddress();
String city = userForm.getCity();
String state = userForm.getState();
String zip = userForm.getZip();
EjbClientDataSet dataSet = sessionBean.getClientDataModule().getUserDataSet();
dataSet.insertRow(false);
dataSet.setString("Username", username);
dataSet.setString("Firstname", password);
dataSet.setString("Lastname", firstname);
dataSet.setString("Address", lastname);
dataSet.setString("City", address);
dataSet.setString("State", city);
dataSet.setString("Zip", state);
dataSet.setString("Password", zip);
dataSet.post();
if ( sessionBean.addUser(username, password) ) {
userForm.reset(actionMapping, httpServletRequest);
return (actionMapping.findForward("welcome"));
}
else {
dataSet.deleteRow();
httpServletRequest.setAttribute("message", "Username aleady exists.");
return (new ActionForward(actionMapping.getInput()));
}
}
}
}
对于该例如何查呢??
谢谢您能不能帮帮我!!