lathjer wrote: > > So as I am trying to figure this out, and it has brought up some > questions. > > > lathjer wrote: >> >> <!-- Action to list users on a "home page" --> >> <action name="ListUsers" class="net.dg.oe.user.UserAction" >> method="list"> >> <result type="tiles">user.list</result> >> </action> >> > > That mapping causes the error. When the UserAction.list() method is called > it is looking for the input result type. > > So my question (or realization) is that apparently the validation > framework depends on the class and not tied to the action name. Is this > correct, or am I off base? > > Everything I have read and researched seems to tell me that the validation > should be tied to the action name and not the action class. I guess I > misunderstood. > Hope this helps you. > > Thanks, > > lathjer > > >
Using a validator (xml-based validation) in Struts 2 requires three steps: 1. determine the action whose input is to be validated (in your case the ListUsers action with the list method) 2. write a validator configuration xml-file which must follow one of these two patterns: ActionClass-validation.xml or ActionClass-alias-validation.xml. The first one is more common. This means, all methods or all actions using this action class use the same validation rules. But there are cases where you only want to apply validation on certain actions. For example, the UserAction class is used with ListUsers action, with DeleteUser action and with UserAction action (propably not a good name for an action). If all three actions are to be validated using the same validation rules, you can simply declare the rules in your UserAction-validation.xml. If ListUsers and DeleteUser use different validation rules you must create two different validator configuration files: UserAction-ListUsers-validation.xml and UserAction-DeleteUser-validation.xml. 3. determine where the user should be forwarded to when validation fails by defining a input result element for each action using validation in your struts.xml file. In your case UserAction extends AbstractCRUDAction and the action method ListUsers is probably defined in your AbstractCRUDAction. Therefore your should define validation rules for this action in a configuration file AbstractCRUDAction-ListUsers-validation.xml. Another useful way is using annotations for validation, but this is another topic. -- View this message in context: http://www.nabble.com/Validation-causing-me-problems-tp20471257p20495372.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]