Web tier: servlets, JSP, Web frameworks: two different page accessing the one page, how to differentiate

  1. Hi All, i have two different pages 'Page1' and 'Page2' both accessing the one page 'Page3', how to differentiate from which page request came and when click on submit on Page3 how to identify which source page(Page1 or Page2) to redirect. Any solutions how to proceed? i am using struts. Please do reply,it's urgent. regards subhashree
  2. I guess you could use the getURL method of the request object which returns a String and then have an if condition to check if it contains Page1 or Page2 and work with that. Anyone else have any good suggestions ? HTH
  3. Pass the source page as a parameter[ Go to top ]

    I would recommend a straightforward approach of actually sending the source page name as a parameter to the child page for source identification. This is a clean and simple approach. When you write your action mappings your can write your forward from the source actions like this: In Page1 ActionMapping: In Page2 ActionMapping: If this is a feature that you require across your application, then it is better to have a Base Action class that adds the source-name parameter to the request before forwarding.