📄 insertform.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
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;
/**
* MyEclipse Struts
* Creation date: 03-17-2008
*
* XDoclet definition:
* @struts.form name="insertForm"
*/
public class InsertForm extends ActionForm {
/*
* Generated fields
*/
/** phone property */
private String phone=null;
/** page property */
private String page=null;
/** address property */
private String address=null;
/** name property */
private String name=null;
/*
* Generated Methods
*/
/**
* Method validate
* @param mapping
* @param request
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
int numPage = 0;
try{
numPage = new Integer(page).intValue();
} catch (Exception e){
}
if (numPage == 1){
if (((name == null) || (name.length() < 1)))
errors.add("name", new ActionMessage("error.name.required"));
if (((phone == null) || (phone.length() < 1)))
errors.add("phone", new ActionMessage("error.phone.required"));
}
if (numPage == 2) {
if (((address == null) || (address.length() < 1)))
errors.add("address", new ActionMessage(
"error.address.required"));
}
return errors;
}
/**
* Method reset
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
//根据“page”的值处理不同的字段
int numPage = 0;
try {
numPage = new Integer(request.getParameter("page")).intValue();
} catch (Exception e){
}
if (numPage == 1){
name = null;
phone = null;
}
if (numPage == 2){
address = null;
}
page = null;
}
/**
* Returns the phone.
* @return String
*/
public String getPhone() {
return phone;
}
/**
* Set the phone.
* @param phone The phone to set
*/
public void setPhone(String phone) {
this.phone = phone;
}
/**
* Returns the page.
* @return String
*/
public String getPage() {
return page;
}
/**
* Set the page.
* @param page The page to set
*/
public void setPage(String page) {
this.page = page;
}
/**
* Returns the address.
* @return String
*/
public String getAddress() {
return address;
}
/**
* Set the address.
* @param address The address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
* Returns the name.
* @return String
*/
public String getName() {
return name;
}
/**
* Set the name.
* @param name The name to set
*/
public void setName(String name) {
this.name = name;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -