bookform.java
来自「是一个简单的图书馆管理系统」· Java 代码 · 共 64 行
JAVA
64 行
package com.yourcompany.struts.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
public class BookForm extends ActionForm{
public String book_no;
public String b_name;
public String author;
public int number;
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors=new ActionErrors();
if (this.book_no==null||book_no.equals("")){
errors.add("book_no",new ActionMessage("book_no.null"));
}
if(this.b_name==null||b_name.equals("")){
errors.add("b_name",new ActionMessage("b_name.null"));}
if(this.author==null||author.equals("")){
errors.add("author",new ActionMessage("author.null"));}
if(this.number==0){
errors.add("number",new ActionMessage("number.null"));}
return errors;
}
public String getBook_no() {
return book_no;
}
public void setBook_no(String book_no) {
this.book_no = book_no;
}
public String getB_name() {
return b_name;
}
public void setB_name(String b_name) {
this.b_name = b_name;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?