This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 Problem

 
anieruddha gaikwad
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,


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.
 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic