How to navigate to last visited page/section after requested user to Signin/Registered with the website?

StackOverflow https://stackoverflow.com/questions/19637154

Question

IBM WebSphere Commerce - eCommerce: I am designing a separate section (Special Dresses) for an eCommerce site and the section having a link to book appointment with the store.

If a guest user visited the section and wants to book an appointment (when clicks on the 'Book an Appt.' link), as per the user type 'Guest', the navigation will go to Sign-In page to log-on or start registering with the site.

[[Existing Scenario for Login/Registration - is once user logged in or done registration then the navigation will go to 'User Profile' page default]]

But here, the user navigated to Log-in page from Special Dresses section. So once they logged-in or done the registration I should show a JSP form to fill dress information. It should not go to User Profile page.

How could achieve the navigation in JSP. Especially in WebSphere Commerce.

Was it helpful?

Solution

IBM WCS V 7.0 (Madison & Elite) starter store acts like this as OOTB . (I am not sure about WCS V 6.0) ,but below are the concept :

  • you need to add authenticate property for your developed/customized view in struts-config-ext.xml as 1 , so this view can only be accessed by registered users

  • when guest user tried to access that page/View , WCS framework will automatically redirect him to login page view asking user to login

  • OOTB login page view JSP content is AccountDisplayContent.jspf the form of the login contiains hidden input with name : "URL" like below:

    <input type="hidden" name="URL" value="<c:out value='${WCParam.URL}'/>" id="WC_AccountDisplay_FormInput_URL_In_Logon_1" />

actually there are logic in the JSP for different possibilities of what URL can be , but one of them is the previous URL page that struts actions framework will fill it for you and become hidden input .

  • this field is been read in OOTB LogonCmdImpl (if you haven't customize it) and after authentication process succeed , this command read that field and redirect you to view that you come from to login page .

  • same process for registration (as long as you use one page for registration , not multiple pages/flows that could make this field lose its value .

Hope that help you look at your code and review what is missing .

Thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top