• 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

Can i Use my action to throw error

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using struts framework with validation support.But i am not using the html and bean tag lib. of struts framework,can i still throw error using action classes.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you do validation in the execute() method of an Action class, you populate an ActionMessages object with ActionMessage objects and then place it in request scope.

It would certainly be possible to retrieve this object from request scope in your JSP and write your own code to display the errors. The question remains: Why would anyone want to when it's so easy to do it with the <html:errors> tag or the <html:messages> tag?

If you really want to do it without using the html:xxx tags, I'd download the Struts source code and see how Struts accomplishes the task of displaying errors. Then use this as a basis for writing your own code.
 
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic