Hi,
Does anyone know how I can retrieve the previous JSP URL that a page has come from within a JSP?
Can I retrieve this from the session/ request/ response object?
Hope this makes sense, Thank you
Hi,
Does anyone know how I can retrieve the previous JSP URL that a page has come from within a JSP?
Can I retrieve this from the session/ request/ response object?
Hope this makes sense, Thank you
(assuming Struts 1)
Well in the struts-config.xml there is a input parameter in the action element (in the action-mappings section) So in your action (java class) you can access this value like this :
public ActionForward action(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
//do some stuff
return mapping.getInputForward(); //return to the caller
}
so if you want an action to return to its originating page, you can define multiple action entry pointing to the same action but with a different name and input value.
Hope that helps.
Assuming that you are talking about navigating within your own application and assuming struts 2 you can pass a parameter to the action, lets call it next, with the name of the next action. Lets say you have an action defined in struts.xml:
<action name="myaction" class="com.me.MyActionClass">
<result name="success">${next}</result>
</action>
In MyActionClass you will have to declare the property next with its getters and setters. On invoking this action you must provide the value for next which could be the same name as the page from which you are invoking the action.
Many thanks - apologies for not being able to mark my correct answer as the site seems to have changed and i cant see how to do this but i used
<%String referer = request.getHeader("Referer"); out.print("" + referer);%>
for example in referer i got the uri as http://www.sun.com/questions?pnr=18&value=gg while i pront referer at that time i got this string ok. now i need to get the parameter value how to get it. from that string