STRUTS——SQL添加

  • g1_865040
    了解作者
  • 1.4MB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-09 07:21
    上传日期
STRUTS——SQL添加
SQL添加.rar
内容介绍
package net.Form; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression; public class Form extends ActionForm { private int userid; private String username; private String password; private String yzm; public String getYzm() { return yzm; } public void setYzm(String yzm) { this.yzm = yzm; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public int getUserid() { return userid; } public void setUserid(int userid) { this.userid = userid; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) {// 错误信息 ActionErrors error = new ActionErrors(); if (this.username.equals("") || this.username == null) {// 用户名验证 ActionError usernameerr = new ActionError("user.name.error"); error.add("username", usernameerr); } if (this.password.equals("") || this.password == null) {// 密码验证 ActionError passworderr = new ActionError("pass.pass.error"); error.add("password", passworderr); } RegularExpression yzmform = new RegularExpression("^[0-9]+$"); if (!yzmform.matches(this.getYzm())) {// 验证码验证 ActionError yzmerr = new ActionError("yzm.yzm.error"); error.add("yzm", yzmerr); } return error; } }
评论
    相关推荐