I've recently started looking into Struts2 and am learning it by building a simple CRUD web application. Compared to Struts1.x, I like the improvements in Struts 2.x, where I can have the same Action class for all operations for my entity. What I mean is, Struts 1.x forced me to have one Action class for each of the CRUD operations of my entity - since execute() method was the only method in the action class, that'd be, well, executed. With Struts2, I can create just one Action class, and implement different methods, one for each of the CRUD operations. Based on how I map them in my struts.xml, the framework will call the specific method for the action I'm invoking. This, coupled with, wildcard action mapping allows to be very concise in struts.xml.
But, when I read about the validate() method in the Action class, I couldn't find a way to have a custom validate() method for each of the action. Needless to say, the inputs for each of the actions is going to be different, and thus the validation also will be different. But, I have only one validate() method. Does this mean that I have to do an if/else on the action name in the validate() method?
I've searched Struts FAQs and this forum but couldn't find any relevant information. I'd appreciate it someone can shed some light on this.