📄 regform.java
字号:
package com.laoer.bbscs.web.form;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import com.laoer.bbscs.sys.*;
import com.laoer.comm.util.*;
/**
* <p>Title: TianYi BBS</p>
* <p>Description: TianYi BBS System</p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: LAOER.COM/TIANYISOFT.NET</p>
* @author laoer
* @version 6.0
*/
public class RegForm
extends ActionForm {
private String action;
private String answer;
private String brief;
private String email;
private short forumPerNum;
private String homePage;
private String icqNo;
private String msn;
private String nickname;
private String oicqNo;
private String passwd;
private short postPerNum;
private String question;
private String repasswd;
private short sex;
private String timeZone;
private String userFrom;
private String username;
private String yahoo;
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getAnswer() {
return answer;
}
public void setAnswer(String answer) {
this.answer = answer;
}
public String getBrief() {
return brief;
}
public void setBrief(String brief) {
this.brief = brief;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public short getForumPerNum() {
return forumPerNum;
}
public void setForumPerNum(short forumPerNum) {
this.forumPerNum = forumPerNum;
}
public String getHomePage() {
return homePage;
}
public void setHomePage(String homePage) {
this.homePage = homePage;
}
public String getIcqNo() {
return icqNo;
}
public void setIcqNo(String icqNo) {
this.icqNo = icqNo;
}
public String getMsn() {
return msn;
}
public void setMsn(String msn) {
this.msn = msn;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getOicqNo() {
return oicqNo;
}
public void setOicqNo(String oicqNo) {
this.oicqNo = oicqNo;
}
public String getPasswd() {
return passwd;
}
public void setPasswd(String passwd) {
this.passwd = passwd;
}
public short getPostPerNum() {
return postPerNum;
}
public void setPostPerNum(short postPerNum) {
this.postPerNum = postPerNum;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getRepasswd() {
return repasswd;
}
public void setRepasswd(String repasswd) {
this.repasswd = repasswd;
}
public short getSex() {
return sex;
}
public void setSex(short sex) {
this.sex = sex;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
public String getUserFrom() {
return userFrom;
}
public void setUserFrom(String userFrom) {
this.userFrom = userFrom;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getYahoo() {
return yahoo;
}
public void setYahoo(String yahoo) {
this.yahoo = yahoo;
}
public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {
ActionErrors errors = new ActionErrors();
if (action == null || action.length() == 0) {
action = "add";
}
if (action.equals("new")) {
if (username == null || username.length() == 0 || nickname == null ||
nickname.trim().length() == 0 || passwd == null ||
passwd.length() == 0 || question == null ||
question.trim().length() == 0 || answer == null ||
answer.trim().length() == 0) {
errors.add("error.nullerror", new ActionError("error.nullerror"));
}
username = username.trim();
nickname = nickname.trim();
question = question.trim();
answer = answer.trim();
if (!Util.validateUserName(username)) {
errors.add("error.reg.name0", new ActionError("error.reg.name0"));
}
if (SysUtil.isBadNickName(nickname)) {
errors.add("error.reg.badnickname",
new ActionError("error.reg.badnickname"));
}
username = username.toLowerCase();
if (SysUtil.isNotAllowRegName(username)) {
errors.add("error.reg.badusername",
new ActionError("error.reg.badusername", username));
}
if (username.length() < 3 || username.length() > 20) {
errors.add("error.reg.username.toolong",
new ActionError("error.reg.username.toolong"));
}
if (SysUtil.getStrLength(nickname, Constant.CHARSET) > 60) {
errors.add("error.reg.nickname.toolong",
new ActionError("error.reg.nickname.toolong"));
}
if (passwd.length() < 3 || passwd.length() > 20) {
errors.add("error.reg.passwd.toolong",
new ActionError("error.reg.passwd.toolong"));
}
if (!passwd.equals(repasswd)) {
errors.add("error.reg.passwd.notsame",
new ActionError("error.reg.passwd.notsame"));
}
if (SysUtil.getStrLength(question, Constant.CHARSET) > 150) {
errors.add("error.reg.question.toolong",
new ActionError("error.reg.question.toolong"));
}
if (SysUtil.getStrLength(answer, Constant.CHARSET) > 150) {
errors.add("error.reg.answer.toolong",
new ActionError("error.reg.answer.toolong"));
}
if (userFrom == null) {
userFrom = "";
}
if (homePage == null) {
homePage = "";
}
if (oicqNo == null) {
oicqNo = "";
}
if (icqNo == null) {
icqNo = "";
}
if (msn == null) {
msn = "";
}
if (yahoo == null) {
yahoo = "";
}
if (brief == null) {
brief = "";
}
}
return errors;
}
public void reset(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -