There is no such thing as 'Struts Framework rules'. In fact there is so many ways you can do this validation in struts that it's confusing for anyone new-to-struts. For example you can either use the commons-validator framework(which I use), or inside the validate method comes with struts formBeans.
>From what I understand about VO pattern, it's a mean for carrying a bunch of attributes at once; cataining any business logic contaminates the neutrality of the VO. After all, the VO can carry not only good data from the clients, but also the bad data, as the one you are trying to validate. And so it's up to the business object to handle this. -----Original Message----- From: sriram [mailto:[EMAIL PROTECTED] Sent: August 28, 2003 10:06 PM To: 'Struts Users Mailing List' Subject: Validations in Action Form My application uses Struts Action Form. I am also using Value Objects. I am not doing validations using validations.xml and validator-rules.xml. I'm performing simple validations on server side as follows: Can some one please check the below code and tell me if what I am doing is correct? In Action Form "validate" method, the code as follows: ===== code in validate method of ActionForm ========== ActionErrors errs = new ActionErrors(); MyValues val = new MyValues(); try { val.setInputField(inputField_); } catch (IllegalArgumentException ex) { errs.add(FLD_INPUT_FIELD,new ActionError("myviewform.error_input_field",ex.getMessage())); } ===== code in Value Object - MyValues ============= public void setInputField(String val) { if (val==null || val.length()==0) throw new IllegalArgumentException("Illegal null parameter passed to setInputField"); if (val!=null && val.length()>100) // max length of this field is 100 throw new IllegalArgumentException("Illegal parameter value too long passed to setInputField,value="+val); inputField_=val; }// end of setInputField ============================================================ With the above code, can I say that the validations are written in "validate" method of ActionForm? Someone mentioned that since I'm performing actual validations in MyValues, the validations are not being done in ActionForm, and so it does not follow Struts Framework rules. Is this true? Please clarify. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

