NoteForm.java
资源名称:Myblog.rar [点击查看]
上传用户:wlfwy2004
上传日期:2016-12-12
资源大小:33978k
文件大小:3k
源码类别:
Jsp/Servlet
开发平台:
Java
- package com.opensource.blog.web.form;
- import javax.servlet.http.*;
- import org.apache.commons.lang.*;
- import org.apache.struts.action.*;
- public class NoteForm
- extends ActionForm {
- private String action;
- private long artid;
- private long blogid;
- private String content;
- private String email;
- private String homepage;
- private String name;
- private String username;
- private String authCode;
- public String getAction() {
- return action;
- }
- public long getArtid() {
- return artid;
- }
- public long getBlogid() {
- return blogid;
- }
- public String getContent() {
- return content;
- }
- public String getEmail() {
- return email;
- }
- public String getHomepage() {
- return homepage;
- }
- public String getUsername() {
- return username;
- }
- public String getName() {
- return name;
- }
- public String getAuthCode() {
- return authCode;
- }
- public void setAction(String action) {
- this.action = action;
- }
- public void setArtid(long artid) {
- this.artid = artid;
- }
- public void setBlogid(long blogid) {
- this.blogid = blogid;
- }
- public void setContent(String content) {
- this.content = content;
- }
- public void setEmail(String email) {
- this.email = email;
- }
- public void setHomepage(String homepage) {
- this.homepage = homepage;
- }
- public void setUsername(String username) {
- this.username = username;
- }
- public void setName(String name) {
- this.name = name;
- }
- public void setAuthCode(String authCode) {
- this.authCode = authCode;
- }
- public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
- ActionErrors errors = new ActionErrors();
- if (StringUtils.isBlank(this.action)) {
- errors.add("error.parametererror", new ActionMessage("error.parametererror"));
- }
- System.out.println(this.action);
- if (this.action.equalsIgnoreCase("add")) {
- System.out.println(this.name);
- if (StringUtils.isBlank(this.name)) {
- errors.add("error.note.add.namenull", new ActionMessage("error.note.add.namenull"));
- }
- //name = name.trim();
- if (StringUtils.isBlank(content)) {
- errors.add("error.note.add.contentnull", new ActionMessage("error.note.add.contentnull"));
- }
- //content = content.trim();
- if (email == null) {
- email = "";
- }
- if (homepage == null) {
- homepage = "";
- }
- if (homepage.equals("http://")) {
- homepage = "";
- }
- }
- return errors;
- }
- public void reset(ActionMapping actionMapping, HttpServletRequest servletRequest) {
- }
- }