What I want is Interceptor should execute before each action-execution, and if it returns result success, the action should be executed. But right now, on calling each action, the interceptor is executing and, based on its result return, the particulat jsp page in getting called. i.e.
Lets suppose I called action : Action1,
1. 'LoginInterceptor' Interceptor gets called
2. If 'LoginInterceptor' retruns "success', then '/WEB-INF/jsp/Action1Success.jsp' is being displayed on browser, Irrespective of the execute() method return result.
anieruddha please Use Code Tags when you post a source code. That way your code looks formatted. Unformatted code is hard to read. You can add code tags by wrapping your code in [code] [/code] tags. You can edit your message using button and then add code tags to it.
When the login is successful, you need to return invocation.invoke() instead of "success". See this tutorial...
Also, the login itself shouldn't be done in an interceptor: the only thing an interceptor should be responsible for is checking to see if (a) the user needs to be logged in, and (b) that the user is logged in. Login itself should be handled by an action.