• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

use of ActionMessages in struts

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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("error.name.required"));
saveMessages(request,messages);
}
else if (getAge() == null || getAge().trim().length() == 0)
{
messages.add("Age", new ActionMessage("error.age.required"));
}
if(messages.size() > 0){
saveMessages(request,messages);
System.out.println("inside from bean and no. of error messages added is= "+ messages.size());
}
return messages;
}
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic