1 16 17 package org.apache.webapp.admin.users; 18 19 20 import javax.servlet.http.HttpServletRequest ; 21 import org.apache.struts.action.ActionError; 22 import org.apache.struts.action.ActionErrors; 23 import org.apache.struts.action.ActionForm; 24 import org.apache.struts.action.ActionMapping; 25 26 27 34 35 public final class RoleForm extends BaseForm { 36 37 38 40 41 43 44 47 private String description = null; 48 49 public String getDescription() { 50 return (this.description); 51 } 52 53 public void setDescription(String description) { 54 this.description = description; 55 } 56 57 58 61 private String rolename = null; 62 63 public String getRolename() { 64 return (this.rolename); 65 } 66 67 public void setRolename(String rolename) { 68 this.rolename = rolename; 69 } 70 71 72 74 75 81 public void reset(ActionMapping mapping, HttpServletRequest request) { 82 83 super.reset(mapping, request); 84 description = null; 85 rolename = null; 86 87 } 88 89 90 100 public ActionErrors validate(ActionMapping mapping, 101 HttpServletRequest request) { 102 103 ActionErrors errors = new ActionErrors(); 104 105 String submit = request.getParameter("submit"); 106 108 if ((rolename == null) || (rolename.length() < 1)) { 110 errors.add("rolename", 111 new ActionError("users.error.rolename.required")); 112 } 113 114 if ((rolename != null) && (rolename.indexOf('"') >= 0)) { 116 errors.add("rolename", 117 new ActionError("users.error.quotes")); 118 } 119 120 if ((description != null) && (description.indexOf('"') > 0)) { 122 errors.add("description", 123 new ActionError("users.error.quotes")); 124 } 125 126 128 return (errors); 129 130 } 131 132 133 } 134 | Popular Tags |