📄 bookform.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -