struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From R Veach <>
Subject Change Action Method In Interceptor
Date Wed, 11 Mar 2015 15:29:08 GMT

I know it is possible to limit struts to specific methods using the
MethodFilterInterceptor, and to change the execute method in the config or
form declaration using the method attribute.

Is it possible to have an interceptor change which method would be executed
in the action? I see I can get the method name using
"invocation.getProxy().getMethod()", but I can't find any setter.

One reason I want to do this is to build submit and first time in logic
without defining it everywhere for every page and have an interceptor do
the work for me.
I would identify if it is first time or submit based on request to see if
it is "GET" or "POST".
I could call the methods directly from the interceptor since I have the
action instance, but that would bypass the rest of the interceptor chain
and would require this interceptor to always be last in the list.

Here is an example of what I was planning:

if (isFirstTime(request)) {
    if (action instanceof FirstTimeLogic) {
} else {
    if (action instanceof SubmitLogic) {

return invocation.invoke();

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message