I am trying to redirect to the page where the user was trying to log in.
I mean, some page -> login -> somepage
I know it;
In LoginAction
HttpServletRequest request = ServletActionContext.getRequest(); String url = request.getServletPath(); setUrl(url);
In struts.xml
<action name="LoginPro" method="login" class="LoginAction"> <result type="redirect">${url}</result> <result name="input" type="tiles">login.error</result> </action>
But it does not work. The requested URL is always "LoginPro", which handles the login process. When the user clicks the login button, the page goes to LoginPro. Therefore, the request URL is always loginPro ...
It seems so; somepage -> login -> loginPro -> LoginAction (url request is loginPro ..) -> loginPro
How can I redirect users to the page where they tried to log in?
struts2
Deckard
source share