Re: Forwarding/redirecting to action mappings rather than directly to JSPs
Matt Yes I did use global forwards exactly as you say, although it should work equally well with mapping level forwards. I'm not sure how to advise you without knowing what you're trying to do. My problem was a sidebar menu which needed to submit changes on the current page, and then to initialise and load the new page whose menu link was clicked, so I needed global forwards as I would not know from which mapping the request came from. My processing after clicking the menu went like this... ...using Javascipt on menu link... 1.) Populate hidden form field (called 'forward') on current page with forward name coresponding to clicked link. 2.) Submit current page. ...at the end of each page action... 3.) Remove any current mapping from the request using the following line: 'request.removeAttribute(Action.MAPPING_KEY);' without this, an infinate loop occurs followed by a stack overflow - because the setting of the new action mapping by the action servlet fails (don't ask me why). 4.) Return the global forward as named by th forward field using the following line: 'return (mapping.findForward(forward))'. - Original Message - From: Matt Raible [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, July 24, 2001 3:57 PM Subject: Re: Forwarding/redirecting to action mappings rather than directly to JSPs Jim, did this solution involve using a global forward or just using something like the following: forward name=success path=/myList.do / Please post samples - thanks for your help! Matt --- Jim [EMAIL PROTECTED] wrote: Matt I got my code to work by removing the mapping from the request before forwarding from my action classes with the following line request.removeAttribute(Action.MAPPING_KEY); Prior to that it seemed that the previous mapping was not being overwritten by the ActionServlet. Hope this helps Jim - Original Message - From: Matt Raible To: [EMAIL PROTECTED] Sent: Friday, July 20, 2001 4:51 AM Subject: Forwarding/redirecting to action mappings rather than directly to JSPs Jim, Did you ever get this post figured out - I'm having a similar problem with iPlanet. http://www.mail-archive.com/struts-user@jakarta.apache.org/msg11046.html Thanks, Matt __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Re: Forwarding/redirecting to action mappings rather than directly to JSPs
Matt I got my code to work by removing the mapping from the request before forwarding from my action classes with the following line request.removeAttribute(Action.MAPPING_KEY); Prior to that it seemed that the previous mapping was not being overwritten by the ActionServlet. Hope this helps Jim - Original Message - From: Matt Raible To: [EMAIL PROTECTED] Sent: Friday, July 20, 2001 4:51 AM Subject: Forwarding/redirecting to action mappings rather than directly to JSPs Jim, Did you ever get this post figured out Im having a similar problem with iPlanet. http://www.mail-archive.com/struts-user@jakarta.apache.org/msg11046.html Thanks, Matt
Re: Forwarding/redirecting to action mappings rather than directly to JSPs
Jim, did this solution involve using a global forward or just using something like the following: forward name=success path=/myList.do / Please post samples - thanks for your help! Matt --- Jim [EMAIL PROTECTED] wrote: Matt I got my code to work by removing the mapping from the request before forwarding from my action classes with the following line request.removeAttribute(Action.MAPPING_KEY); Prior to that it seemed that the previous mapping was not being overwritten by the ActionServlet. Hope this helps Jim - Original Message - From: Matt Raible To: [EMAIL PROTECTED] Sent: Friday, July 20, 2001 4:51 AM Subject: Forwarding/redirecting to action mappings rather than directly to JSPs Jim, Did you ever get this post figured out - I'm having a similar problem with iPlanet. http://www.mail-archive.com/struts-user@jakarta.apache.org/msg11046.html Thanks, Matt __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Forwarding/redirecting to action mappings rather than directly to JSPs
Hi I have an action classfrom which I need to forward to another action mapping (rather than directly to a JSP), and I have managed to get this working by setting up a global forward to an absolute path with rediredt set to true as follows: global-forwards forward name="myForward" path="http://myServer/myDB/myApp/myMapping.do" redirect="true"/ /global-forwards Apart from the inconvenience of having to change the path in struts-config.xml for each deployment, this was fine. Now however I am trying to deploy to a 2 different servers (to which requests are forwarded tofrom a load balancing server). Both these servers share the same database (and therefore the same war file) and so the above forward will failwhen accessed from the other server. The best way to do this would be to use a relative path, but this errors at runtime saying the path must be absolute. Another way would be to add the forward dynamically to the ActionServlet at runtime but I don't know how to get a reference to the servlet instance so I can call its methods. Any help is appreciated Jim
Re: Forwarding/redirecting to action mappings rather than directly to JSPs
The relative path redirect issue is likely caused by Silverstream (as of 3.7.1) not fully implementing the servlet 2.2 spec. Ifso I'm left with trying to add the forwards to the actionservlet at runtime. - Original Message - From: Jim Quittenton To: [EMAIL PROTECTED] Sent: Wednesday, July 04, 2001 4:55 PM Subject: Forwarding/redirecting to action mappings rather than directly to JSPs Hi I have an action classfrom which I need to forward to another action mapping (rather than directly to a JSP), and I have managed to get this working by setting up a global forward to an absolute path with rediredt set to true as follows: global-forwards forward name="myForward" path="http://myServer/myDB/myApp/myMapping.do" redirect="true"/ /global-forwards Apart from the inconvenience of having to change the path in struts-config.xml for each deployment, this was fine. Now however I am trying to deploy to a 2 different servers (to which requests are forwarded tofrom a load balancing server). Both these servers share the same database (and therefore the same war file) and so the above forward will failwhen accessed from the other server. The best way to do this would be to use a relative path, but this errors at runtime saying the path must be absolute. Another way would be to add the forward dynamically to the ActionServlet at runtime but I don't know how to get a reference to the servlet instance so I can call its methods. Any help is appreciated Jim