SortForm.java
资源名称:Myblog.rar [点击查看]
上传用户:wlfwy2004
上传日期:2016-12-12
资源大小:33978k
文件大小:2k
源码类别:
Jsp/Servlet
开发平台:
Java
- package com.opensource.blog.web.form;
- import org.apache.struts.action.ActionForm;
- import org.apache.struts.action.ActionErrors;
- import org.apache.struts.action.ActionMapping;
- import javax.servlet.http.HttpServletRequest;
- import org.apache.commons.lang.*;
- import org.apache.struts.action.ActionMessage;
- public class SortForm
- extends ActionForm {
- private String action;
- private String addsortname;
- private long sortid;
- private String upsortname;
- public String getAction() {
- return action;
- }
- public void setAction(String action) {
- this.action = action;
- }
- public void setUpsortname(String upsortname) {
- this.upsortname = upsortname;
- }
- public void setSortid(long sortid) {
- this.sortid = sortid;
- }
- public void setAddsortname(String addsortname) {
- this.addsortname = addsortname;
- }
- public String getAddsortname() {
- return addsortname;
- }
- public long getSortid() {
- return sortid;
- }
- public String getUpsortname() {
- return upsortname;
- }
- public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
- ActionErrors errors = new ActionErrors();
- if (StringUtils.isBlank(this.action)) {
- this.action = "show";
- }
- if (this.action.equalsIgnoreCase("add")) {
- if (StringUtils.isBlank(this.addsortname)) {
- errors.add("error.sort.sortnamenull", new ActionMessage("error.sort.sortnamenull"));
- }
- }
- if (this.action.equalsIgnoreCase("up")) {
- if (sortid == 0) {
- errors.add("error.parametererror", new ActionMessage("error.parametererror"));
- }
- if (StringUtils.isBlank(this.upsortname)) {
- errors.add("error.sort.sortnamenull", new ActionMessage("error.sort.sortnamenull"));
- }
- }
- if (this.action.equalsIgnoreCase("del")) {
- if (sortid == 0) {
- errors.add("error.parametererror", new ActionMessage("error.parametererror"));
- }
- }
- return null;
- }
- public void reset(ActionMapping actionMapping, HttpServletRequest servletRequest) {
- }
- }