This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes use of ActionMessages in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "use of ActionMessages in struts" Watch "use of ActionMessages in struts" New topic

use of ActionMessages in struts

shashanka jena

Joined: Aug 23, 2006
Posts: 10
Earlier I was using struts 1.1 and in that ActionError was working fine but currently I am using struts 1.2 and with this ActionError is depricated so I am trying to use ActionMessages in my form bean by overriding validate() and getting an error as follows :
The method saveMessages(HttpServletRequest, ActionMessages) is undefined for the type LookupForm
LookupForm is my form bean class name
My code of validate() inside form bena class i.e LookupForm

public ActionMessages validate(HttpServletRequest request) {

ActionMessages messages = new ActionMessages();

if (getName() == null || getName().trim().length() == 0)
messages.add("Name", new ActionMessage(""));
else if (getAge() == null || getAge().trim().length() == 0)
messages.add("Age", new ActionMessage("error.age.required"));
if(messages.size() > 0){
System.out.println("inside from bean and no. of error messages added is= "+ messages.size());
return messages;

Thanks and Regards<br />shashanka Jena
It is sorta covered in the JavaRanch Style Guide.
subject: use of ActionMessages in struts