📄 adddvdform.java
字号:
/* * AddDVDForm.java * * */package com.dvd.view;import javax.servlet.http.HttpServletRequest;import org.apache.struts.action.ActionErrors;import org.apache.struts.action.ActionMapping;import org.apache.struts.action.ActionMessage;/** * * @author * @version */public class AddDVDForm extends org.apache.struts.action.ActionForm { private String title; private String year; private String genre; private String newGenre; /** * */ public AddDVDForm() { super(); // TODO Auto-generated constructor stub } public String getTitle() { return this.title; } public void setTitle(String title) { this.title = title; } public String getYear() { return this.year; } public void setYear(String year) { this.year = year; } public String getGenre() { return this.genre; } public void setGenre(String genre) { this.genre = genre; } public String getNewGenre() { return this.newGenre; } public void setNewGenre(String newGenre) { this.newGenre = newGenre; } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); // Form verification if ( title.length() == 0 ) { errors.add("title", new ActionMessage("error.titleField.required")); } if ( year.length() == 0 ) { errors.add("year", new ActionMessage("error.yearField.required")); } else if (!year.matches("\\d\\d\\d\\d")) { errors.add("year", new ActionMessage("error.yearField.invalid")); } return errors; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -