📄 editform.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.hevttc.book.web.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
/**
* MyEclipse Struts Creation date: 10-15-2007
*
* XDoclet definition:
*
* @struts.form name="editForm"
*/
public class EditForm extends BaseForm {
// String类型, 书的ID号
private String bookid = "";
// String类型,书的名字
private String bookname = "";
// String类型,书的作者
private String author = "";
// String类型,出版社
private String publishingcompany = "";
// Stirng类型,出版日期
private String publishdate = "";
// Stirng类型,库存量
private String storage = "";
private String fn = "";
/*
* Generated Methods
*/
public String getBookid() {
return bookid;
}
public void setBookid(String bookid) {
this.bookid = bookid;
}
public String getBookname() {
return bookname;
}
public void setBookname(String bookname) {
this.bookname = bookname;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getPublishingcompany() {
return publishingcompany;
}
public void setPublishingcompany(String publishingcompany) {
this.publishingcompany = publishingcompany;
}
public String getPublishdate() {
return publishdate;
}
public void setPublishdate(String publishdate) {
this.publishdate = publishdate;
}
public String getStorage() {
return storage;
}
public void setStorage(String storage) {
this.storage = storage;
}
public String getFn() {
return fn;
}
public void setFn(String fn) {
this.fn = fn;
}
/**
* Method validate
*
* @param mapping
* @param request
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors=new ActionErrors();
if(fn.equals("modifyConfim")||fn.equals("addconfirm")){
if (this.bookname.equals("") || this.bookname.matches("\\s+")) {
errors.add("booknamerequired", new ActionError("error.bookname.required"));
}
if (bookname.length() > 50) {
errors.add("booknamelength", new ActionError("error.bookname.length"));
}
if (author.equals("") || bookname.matches("\\s+")) {
errors.add("authorrequired", new ActionError("error.author.required"));
}
if (author.length() > 10) {
errors.add("authorlength",new ActionError("error.author.length"));
}
if (publishingcompany.equals("") || publishingcompany.matches("\\s+")) {
errors.add("publishrequired",new ActionError("error.publish.required"));
}
if (publishingcompany.length() > 20) {
errors.add("publishlength",new ActionError("error.publish.length"));
}
if (publishdate.equals("") || publishdate.matches("\\s+")) {
errors.add("publishdaterequired",new ActionError("error.publishdate.required"));
} else if (!publishdate
.matches("(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)")) {
errors.add("publishdateformat",new ActionError("error.publishdate.format"));;
}
if (storage.equals("") || storage.matches("\\s+")) {
errors.add("storagerequired",new ActionError("error.storage.required"));
} else if (!storage.matches("^[1-9]\\d*$")) {
errors.add("storageformat",new ActionError("error.storage.format"));
}
}
return errors;
}
/**
* Method reset
*
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -