The page navigation flow is as follows for the Order Track Application: 1) Login page : Enter user name/password.Upon success, show the main menu. 2) Main Menu: Choose "Track Order" from the drop down menu and show the Order Search Page. 3) Order Search: enter search parameters, click "Find".All the orders that match the search params are listed.Click on any single order. 4) Order Details page comes up.This page uses the "orderId" primary key that we get from the previous step.So, the url is like http://xyz/ordertrack/searchOrders.do?method=search&orderId=123
The requirement is to enable access from outside the application a.k.a "deep link".So, when the users access the above url and they are not already logged in, they are presented with the login page.However, upon successful login, the remaining navigational steps shall be skipped and they should land directly to the orderDetails page.
I am thinking of a solution like this: 1)Hold this orderId in session upon the very first access of the given url. 2)Modify the login code so that upon success it always checks whether the orderId is present in session or not.If it is there, then redirect to the orderDetails page with the stored orderId and clear the session order Id. If it is not there, then present the main menu (as before).
However, I'am thinking that this is spaghetti code and tomorrow if I need to "deep link" another URL, then the login code will be littered with if- then-elses. Anybody has got a better, more elegant idea? Thanks for your patience in reading this long post.
I am not using anything like Oblix/TAM or another Identity Manager Product in this application so doing a redirect using that is ruled out.
Joined: Jul 22, 2008
Actually, after lot of thinking I came to a conclusion that this is a matter of redirecting within the Action Class to a different ActionForward. This has to be done without using send.redirect and it should also be able to send the request Parameters. Any Body?
This idea should allow you to not have to change code if another scenario occurs where someone wants to do a deep link. This is just what I thought of off the top of my head so take it for what its worth. Let me know if I can clarify.
Joined: Jul 22, 2008
In your log in jsp retrieve the URL (if one exists)from the reqeust and store it in a hidden field on the jsp
Thanks. This was a good idea and at least all spaghetti code is now out of the central login module. I applied a modified version of this idea and stored the URL in the session. Then upon getting to the target page, I clear this URL from the session. Thanks a great deal again.