I'm using the wildcard method in my configuration
<action name="foo-*" class="FooAction" method="{1}">
<result name="success">pages/foo.jsp</result> ...
and I want validation to fire only upon the call to the method that
performs the save/update. No problem with the XML file as the name takes
care of that (e.g., assuming "save" is the method name:
FooAction-foo-save-validation.xml).
What about when I use the validate() method? Is there a
standard/convention for that? I did the following, but I'm wondering if
that is the "best" way.
String invokingMethod =
ActionContext.getContext().getActionInvocation().getProxy().getMethod();
if (invokingMethod.equals("save")) {
// Do validation
}
That solution adds more framework into my action class which I'm not wild
about, but I already have interfaces and I'm extending ActionSupport, so
adding one more thing... okay I guess?
I realize I could validate inside my "save" method, but again, I'm
wondering what the /best/ approach is (i.e., standard/convention).
- Eric