1 19 20 package com.sslexplorer.core.forms; 21 22 import org.apache.struts.action.ActionForm; 23 import org.apache.struts.action.ActionMapping; 24 25 import com.sslexplorer.security.Constants; 26 27 48 public class CoreForm extends ActionForm { 49 50 52 protected String referer; 53 private String actionTarget; 54 protected boolean editing; 55 56 59 public CoreForm() { 60 super(); 61 } 62 63 68 public boolean getEditing() { 69 return editing; 70 } 71 72 76 public void setCreating() { 77 this.editing = false; 78 } 79 80 84 public void setEditing() { 85 this.editing = true; 86 this.actionTarget = "edit"; 87 } 88 89 97 public String get_charset_() { 98 return System.getProperty("sslexplorer.encoding", "UTF-8"); 99 } 100 101 108 public void setActionTarget(String actionTarget) { 109 this.actionTarget = actionTarget; 110 } 111 112 119 public String getActionTarget() { 120 return actionTarget; 121 } 122 123 132 public void setReferer(String referer) { 133 this.referer = referer; 134 } 135 136 137 146 public String getReferer() { 147 return referer; 148 } 149 150 153 public void reset(ActionMapping mapping, javax.servlet.http.HttpServletRequest request) { 154 referer = null; 155 actionTarget = null; 156 request.setAttribute(Constants.REQ_ATTR_ACTION_MAPPING, mapping); 157 request.setAttribute(Constants.REQ_ATTR_FORM, this); 158 } 159 160 166 public boolean isCancelling() { 167 return getActionTarget().equals("cancel"); 168 } 169 170 174 public static boolean isEmpty(String value) { 175 return value == null || value.trim().length() == 0; 176 } 177 178 184 public boolean isCommiting() { 185 return "commit".equals(getActionTarget()); 186 } 187 } | Popular Tags |