How to generically forward to page you came from?
Hi, I am creating a generic action class that after it is finished it needs to forward to the page that called it. I have tried mapping.getInput() but obviously since I haven't specified a input page in the struts.xml for the action class I can't use that. Any thoughts? Alex
Re: How to generically forward to page you came from?
OBS.: I DON'T THINK THIS IS THE BEST WAY BUT... You can use the method: org.apache.struts.action.ActionMapping.addForward(ActionForward forward) that use as parameter an ActionForward constructed with: ActionForward(java.lang.String path) where path is of course your base name Any coments are welcome. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 30, 2001 05:03 PM Subject: How to generically forward to page you came from? Hi, I am creating a generic action class that after it is finished it needs to forward to the page that called it. I have tried mapping.getInput() but obviously since I haven't specified a input page in the struts.xml for the action class I can't use that. Any thoughts?
RE: How to generically forward to page you came from?
Alex, Here is one approach. When linking to the generic action class, include the URI of the page that the link is on as a parameter. For example: % String referrer = request.getRequestURI(); request.setAttribute(referrer, referrer); % html:link href=/generic/action/class paramId=referrer paramName=referrerClick here/html:link Within the action, parse the parameter that designates the referrer, and construct an ActionForward back to it: For example: return new ActionForward(request.getParameter(referrer)); Error checking code ommitted for the sake of brevity. David -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 30, 2001 4:04 PM To: Struts Subject: How to generically forward to page you came from? Hi, I am creating a generic action class that after it is finished it needs to forward to the page that called it. I have tried mapping.getInput() but obviously since I haven't specified a input page in the struts.xml for the action class I can't use that. Any thoughts? Alex