LogoForm.java
资源名称:Myblog.rar [点击查看]
上传用户:wlfwy2004
上传日期:2016-12-12
资源大小:33978k
文件大小:1k
源码类别:
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 LogoForm
- extends ActionForm {
- private String action;
- private String logourl;
- public String getAction() {
- return action;
- }
- public void setAction(String action) {
- this.action = action;
- }
- public void setLogourl(String logourl) {
- this.logourl = logourl;
- }
- public String getLogourl() {
- return logourl;
- }
- public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
- ActionErrors errors = new ActionErrors();
- if (StringUtils.isBlank(this.action)) {
- this.action = "up";
- }
- if (this.action.equalsIgnoreCase("updo")) {
- if (logourl == null || logourl.length() == 0) {
- errors.add("error.logo.urlnull", new ActionMessage("error.logo.urlnull"));
- }
- if (!logourl.startsWith("http://")) {
- errors.add("error.logo.urlstartwithhttp", new ActionMessage("error.logo.urlstartwithhttp"));
- }
- }
- return errors;
- }
- public void reset(ActionMapping actionMapping, HttpServletRequest servletRequest) {
- }
- }