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.
posted 10 years ago
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.