webtier@glassfish.java.net

redirect the user once logged in to the requested page

From: <webtier_at_javadesktop.org>
Date: Thu, 04 Mar 2010 20:29:25 PST

Hi
I have a form realm authentication
with which i am securing a directory "secureUser"

well my question is: -
How i can redirect the user once logged in to the requested page

the details: -

now i can log on a user using this (login.jsp)

==============================================================

                <form action="j_security_check" method="POST" id="login_from">
                <p>
                            <input type="text" name="j_username" id="j_username" title="EmailID" />
                            </p>
                            <p>
                            <input type="password" name="j_password" id="j_password" title="Password" />
                            </p>
                            <p>
                            <input type="submit" name="Submit" id="Login" value="Login" />
                            </p>
                </form>

==============================================================

Now a user requests two or more pages in the same session browser (firefox/ie tabs)
"secureUser/one.jsp"
"secureUser/two.jsp"
"secureUser/three.jsp"

Now the user gets a login form page thats login.jsp for all the three requested pages

The user authenticates into the page requested "secureUser/one.jsp"

Now if the user reloads the page "secureUser/two.jsp" or "secureUser/three.jsp" which is now showing login.jsp
he gets the same login.jsp page

How i can redirect the user after logging in once to the requested page
such that the page login.jsp after reloading goes to referred page

I can do this in the login.jsp page

==============================================================
            java.security.Principal obj = request.getUserPrincipal();

            if(obj!=null)
            {
                response.sendRedirect("secureUser/one.jsp");
            }

==============================================================

but i cannot get the referred page such as two.jsp or three.jsp

Thanks
Pradyut
[Message sent by forum member 'pradyut' (pradyut100_at_yahoo.com)]

http://forums.java.net/jive/thread.jspa?messageID=390185