Consider below action class with three action mappings. Two of them are
annotated with a custom annotation `@AjaxAction`
public class MyAction extends ActionSupport{
@Action("action1")
@AjaxAction //My custom anotation
public String action1(){
}
@Action("action2")
public String action2(){
}
@Action("action3")
@AjaxAction //My custom anotation
public String action3(){
}
}
In an interceptor I want to access the `@AjaxAction` annotation. Is there any
built in support for this?!
If not can I shall read the action name with
`ActionContext.getContext().getName();` and save a list of `ajaxAction` names
in interceptor as an array and compare action name with this array! any better
way?!
private static final String[] AJAX_ACTIONS = new String[] {"action1",
"action3"}
//in interceptor
String actionName = ActionContext.getContext().getName();
if (Arrays.asList(AJAX_ACTIONS).contains(actionName)) {
// do something
}
~Regards,
~~Alireza Fattahi