aspose file tools*
The moose likes Struts and the fly likes Struts 1.3: validation via validate method and via validation.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 1.3: validation via validate method and via validation.xml" Watch "Struts 1.3: validation via validate method and via validation.xml" New topic
Author

Struts 1.3: validation via validate method and via validation.xml

Fran Cricket
Greenhorn

Joined: Nov 03, 2012
Posts: 9
Hi all,
is there a way to use both validation via validate method and via validation.xml?
I succeed in using each of them but not together.

Thanks
Cri
Fran Cricket
Greenhorn

Joined: Nov 03, 2012
Posts: 9
I succeed in using both validation via validate() method and via validation.xml, but not all the errors in the validation.xml are considered. For example those in which depends attribute is "required".
Before they worked.

Any suggetions?

Osama Alawna
Greenhorn

Joined: Dec 05, 2011
Posts: 4
You should do the following:

@Override
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {

ActionErrors errors = super.validate(mapping, request);
if(errors == null) {
errors = new ActionErrors();
}

errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage("key"));

return errors;
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 1.3: validation via validate method and via validation.xml