Re: redirects / actionErrors
Struts 1.2 has a feature you can use that allows you to store your ActionMessages in session variables, then have it removed once they're accessed. I haven't used this yet, but you can probably build on this by storing your errors before you redirect, then have them displayed by the resource your redirected to. Another option is the extensions at http://www.rabago.net/struts/redirect which actually adds your messages (error or not) to the url paramters and puts them back on the ActionMessages queue upon redirection. hth, Hubert --- mucus snot <[EMAIL PROTECTED]> wrote: > Hi, > > I am using action errors as a means of passing messages to the request: > > e.g. > > in Action, execute method... > > errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.to.user")); > saveErrors(request, errors); > return mapping.findForward(Constants.REDIRECT_KEY); > > But if I redirect from this action to another forward that is also an > action, the actionError is out of scope. > > I would be interested to know if > (a) this is good practice - to forward to another forward (it seems to work > > for me) > (b) there is an easy way to carry the actionError forward within storing in > > the session, and saving it in the redirected request. > > Hope I'm making sense, > > Thanks, al __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: redirects / actionErrors
Ok, but i think you will lose your request attributes (because redirect will generate a new request from your browser)...Session or application attributes will be preserved. mucus snot wrote: Hi, I am intending to use a redirect rather than a forward. For me, it adds clarity for the user, and also if they refresh the page, they may get something unexpected. Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: redirects / actionErrors
Hi, I am intending to use a redirect rather than a forward. For me, it adds clarity for the user, and also if they refresh the page, they may get something unexpected. Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: redirects / actionErrors
Hi, I don't know if i could understand your doubt (correct me if i'm wrong) but you must "forward" to your .jsp page and not "redirect"... If you have a global forward (in your struts-config.xml) like the request will be "forwarded" to the .jsp resource. But if you have the request will "redirected" (then you will "lose" the attributes in your request) mucus snot wrote: Hi, I am using action errors as a means of passing messages to the request: e.g. in Action, execute method... errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.to.user")); saveErrors(request, errors); return mapping.findForward(Constants.REDIRECT_KEY); But if I redirect from this action to another forward that is also an action, the actionError is out of scope. I would be interested to know if (a) this is good practice - to forward to another forward (it seems to work for me) (b) there is an easy way to carry the actionError forward within storing in the session, and saving it in the redirected request. Hope I'm making sense, Thanks, al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Redirects
Thanks for this. I've just tested in my reconfigured WebSphere 4.0.3 and my redirects now work. Subject: RE: Redirects From: "Witbeck, Shane" <[EMAIL PROTECTED]> Date: Tue, 01 Apr 2003 11:18:55 -0500 To: [EMAIL PROTECTED] This is a known issue with WebSphere. There is an e-fix for this but you also have to explicitly set a System Properties value. In the admin console under Application Servers > Default Server > JVM Settings add: name com.ibm.websphere.sendredirect.compliance value 1 This makes WebSphere compliant to Servlet spec 2.3. Be aware if there has been any workarounds in existing code to address this...adding this System property may break them ;) HTH, Shane - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Redirects
This is a known issue with WebSphere. There is an e-fix for this but you also have to explicitly set a System Properties value. In the admin console under Application Servers > Default Server > JVM Settings add: name com.ibm.websphere.sendredirect.compliance value 1 This makes WebSphere compliant to Servlet spec 2.3. Be aware if there has been any workarounds in existing code to address this...adding this System property may break them ;) HTH, Shane -Original Message- From: Damian Staniforth [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 10:54 AM To: [EMAIL PROTECTED] Subject: Redirects Hi, We are currently using 1.1 b3 and are having problems with redirect ActionForwards in certain servlet containers. In WebSphere 4.0.3 if I have an application deployed with a context root of '/app' and within an ActionForward redirect to '/add.do', the browser actually redirects to '/app/app/add.do' and struts sees '/app/add.do' rather than '/add.do'. In Tomcat (4.0.3?) I don't see the problem. Looking at the code of RequestProcessor.java the processForwardConfig method prepends request.getContextPath to the path in the ActionForward. Reading the servlet spec I believe that the servlet container should worry about the context root and not the application. Is anyone else having problems with redirects, or have I misunderstood struts redirecting? Cheers Damian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Redirects
This is fixed in RC1. David From: Damian Staniforth <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Redirects Date: Tue, 01 Apr 2003 16:54:20 +0100 Hi, We are currently using 1.1 b3 and are having problems with redirect ActionForwards in certain servlet containers. In WebSphere 4.0.3 if I have an application deployed with a context root of '/app' and within an ActionForward redirect to '/add.do', the browser actually redirects to '/app/app/add.do' and struts sees '/app/add.do' rather than '/add.do'. In Tomcat (4.0.3?) I don't see the problem. Looking at the code of RequestProcessor.java the processForwardConfig method prepends request.getContextPath to the path in the ActionForward. Reading the servlet spec I believe that the servlet container should worry about the context root and not the application. Is anyone else having problems with redirects, or have I misunderstood struts redirecting? Cheers Damian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]