package com.struts2.action;
import java.util.Date;
import com.opensymphony.xwork2.ActionSupport;
public class RegAction extends ActionSupport {
private static final long serialVersionUID = -4577030921155955563L;
private String username;
private String password;
private String confirm;
private Date birthday;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getConfirm() {
return confirm;
}
public void setConfirm(String confirm) {
this.confirm = confirm;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String execute() throws Exception {
return SUCCESS;
}
// 数据校验
@Override
public void validate() {
if (username == null || username.trim().equals("")) {
addFieldError("username", "用户名不能为空!");
}
if (birthday == null || birthday.after(new Date())) {
addFieldError("birthday", "生日日期不正确!");
}
if (password == null || password.trim().equals("")) {
addFieldError("password", "密码不能为空!");
}
if (!password.equals(confirm)) {
addFieldError("confirm", "两次输入密码不一样!");
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Struts2体验程序
共20个文件
properties:6个
xml:3个
tld:2个
需积分: 0 3 下载量 10 浏览量
2008-10-20
11:51:40
上传
评论
收藏 28KB RAR 举报
温馨提示
Struts2体验程序,实现简单的Strtus2功能,初学者用体验程序!
资源详情
资源评论
资源推荐
收起资源包目录
UserReg.rar (20个子文件)
UserReg
.project 1KB
.settings
org.eclipse.jdt.core.prefs 330B
.mymetadata 294B
WebRoot
success.jsp 455B
WEB-INF
web.xml 650B
lib
classes
struts.properties 66B
com
struts2
action
RegAction.class 2KB
struts-tags.tld 353KB
struts.xml 449B
globalMessages_en_US.properties 78B
globalMessages_zh_CN.properties 109B
META-INF
MANIFEST.MF 39B
register.jsp 667B
.myeclipse
src
struts.properties 66B
com
struts2
action
RegAction.java 1KB
struts-tags.tld 353KB
struts.xml 449B
globalMessages_en_US.properties 78B
globalMessages_zh_CN.properties 109B
.classpath 732B
共 20 条
- 1
ruyuecat
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0