📄 addnewsform.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.hao2007.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-30-2007
*
* XDoclet definition:
* @struts.form name="addNewsForm"
*/
public class AddNewsForm extends ActionForm {
/*
* Generated fields
*/
/** title property */
private String title;
/** key_words property */
private String key_words;
/** content property */
private String content;
/** sort_id property */
private String sort_id;
/** source property */
private String source;
/** author property */
private String author;
/*
* Generated Methods
*/
/**
* Method validate
* @param mapping
* @param request
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
ActionErrors errors=new ActionErrors();
if(getTitle().trim()==null || getTitle().trim().length()<2){
errors.add("add.news.title.error",new ActionMessage("add.news.title.errors"));
}
if(getKey_words().trim()==null || getKey_words().trim().length()<2){
errors.add("add.news.key_words.error",new ActionMessage("add.news.key_words.errors"));
}
if(getContent().trim()==null || getContent().trim().length()<10){
errors.add("add.news.content.error",new ActionMessage("add.news.content.errors"));
}
if(getSort_id().trim()==null || getSort_id().trim()==""){
errors.add("add.news.sort_id.error",new ActionMessage("add.news.sort_id.errors"));
}
if(getSource().trim()==null || getSource().trim().length()<2){
errors.add("add.news.source.error",new ActionMessage("add.news.source.errors"));
}
if(getAuthor().trim()==null || getAuthor().trim().length()<2){
errors.add("add.news.author.error",new ActionMessage("add.news.author.errors"));
}
return errors;
}
/**
* Method reset
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
}
/**
* Returns the title.
* @return String
*/
public String getTitle() {
return title;
}
/**
* Set the title.
* @param title The title to set
*/
public void setTitle(String title) {
this.title = title;
}
/**
* Returns the key_words.
* @return String
*/
public String getKey_words() {
return key_words;
}
/**
* Set the key_words.
* @param key_words The key_words to set
*/
public void setKey_words(String key_words) {
this.key_words = key_words;
}
/**
* Returns the content.
* @return String
*/
public String getContent() {
return content;
}
/**
* Set the content.
* @param content The content to set
*/
public void setContent(String content) {
this.content = content;
}
/**
* Returns the sort_id.
* @return String
*/
public String getSort_id() {
return sort_id;
}
/**
* Set the sort_id.
* @param sort_id The sort_id to set
*/
public void setSort_id(String sort_id) {
this.sort_id = sort_id;
}
/**
* Returns the source.
* @return String
*/
public String getSource() {
return source;
}
/**
* Set the source.
* @param source The source to set
*/
public void setSource(String source) {
this.source = source;
}
/**
* Returns the author.
* @return String
*/
public String getAuthor() {
return author;
}
/**
* Set the author.
* @param author The author to set
*/
public void setAuthor(String author) {
this.author = author;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -