RE: How to Redirect to a status Page on HTTP status 403
How about this: Call response.sendError(HttpServletResponse.SC_FORBIDDEN, some description msg) in your action if the user is not in the role; Saul -Original Message- From: alvin antony [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 9:49 AM To: Struts Users Mailing List Subject: How to Redirect to a status Page on HTTP status 403 Hi there, I have restricted the access to my actions with user Roles (in struts-config.xml and WEB.xml) and it works fine.. Thanks to JAAS. I couldn't't find the way to redirect user request to a status error page, in case he is not in the Role for requesting a page. any help? I am using... Struts1.1 Tomcat 4.1.27 any help would be appreciated! Alvin Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to Redirect to a status Page on HTTP status 403
Hi Saul, Thanks for your replay. I knew this is one solution. But in my case the user is redirected to status message from Struts controller or tomcat authenticator. I would prefer to redirect the user to a jsp page with a descriptive message. It would be fine , if I can define some how in a config file that, on HTTP status 403, redirect to the http403.jsp or so? is this possible? Thanks Alvin n [EMAIL PROTECTED] wrote: How about this: Call response.sendError(HttpServletResponse.SC_FORBIDDEN, some description msg) in your action if the user is not in the role; Saul -Original Message- From: alvin antony [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 9:49 AM To: Struts Users Mailing List Subject: How to Redirect to a status Page on HTTP status 403 Hi there, I have restricted the access to my actions with user Roles (in struts-config.xml and WEB.xml) and it works fine.. Thanks to JAAS. I couldn't't find the way to redirect user request to a status error page, in case he is not in the Role for requesting a page. any help? I am using... Struts1.1 Tomcat 4.1.27 any help would be appreciated! Alvin Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now.
RE: How to Redirect to a status Page on HTTP status 403
I think you can configure that in the web.xml file, something like befow: error-page error-code403/error-code location/http403.jsp/location /error-page you may need to check the dtd to see it's exact location in web.xml. Saul -Original Message- From: alvin antony [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 10:52 AM To: Struts Users Mailing List Subject: RE: How to Redirect to a status Page on HTTP status 403 Hi Saul, Thanks for your replay. I knew this is one solution. But in my case the user is redirected to status message from Struts controller or tomcat authenticator. I would prefer to redirect the user to a jsp page with a descriptive message. It would be fine , if I can define some how in a config file that, on HTTP status 403, redirect to the http403.jsp or so? is this possible? Thanks Alvin n [EMAIL PROTECTED] wrote: How about this: Call response.sendError(HttpServletResponse.SC_FORBIDDEN, some description msg) in your action if the user is not in the role; Saul -Original Message- From: alvin antony [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 9:49 AM To: Struts Users Mailing List Subject: How to Redirect to a status Page on HTTP status 403 Hi there, I have restricted the access to my actions with user Roles (in struts-config.xml and WEB.xml) and it works fine.. Thanks to JAAS. I couldn't't find the way to redirect user request to a status error page, in case he is not in the Role for requesting a page. any help? I am using... Struts1.1 Tomcat 4.1.27 any help would be appreciated! Alvin Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to Redirect to a status Page on HTTP status 403
Hi Saul, Thanks it works. Alvin Saul Q Yuan [EMAIL PROTECTED] wrote: I think you can configure that in the web.xml file, something like befow: 403 /http403.jsp you may need to check the dtd to see it's exact location in web.xml. Saul -Original Message- From: alvin antony [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 10:52 AM To: Struts Users Mailing List Subject: RE: How to Redirect to a status Page on HTTP status 403 Hi Saul, Thanks for your replay. I knew this is one solution. But in my case the user is redirected to status message from Struts controller or tomcat authenticator. I would prefer to redirect the user to a jsp page with a descriptive message. It would be fine , if I can define some how in a config file that, on HTTP status 403, redirect to the http403.jsp or so? is this possible? Thanks Alvin n wrote: How about this: Call response.sendError(HttpServletResponse.SC_FORBIDDEN, some description msg) in your action if the user is not in the role; Saul -Original Message- From: alvin antony [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 9:49 AM To: Struts Users Mailing List Subject: How to Redirect to a status Page on HTTP status 403 Hi there, I have restricted the access to my actions with user Roles (in struts-config.xml and WEB.xml) and it works fine.. Thanks to JAAS. I couldn't't find the way to redirect user request to a status error page, in case he is not in the Role for requesting a page. any help? I am using... Struts1.1 Tomcat 4.1.27 any help would be appreciated! Alvin Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now.
Re: how to redirect url without losing attached request attributes
No, you should forward instead of redirecting. You could consider pulling the needed info out of the old request parameters and manually concatenating it onto the redirect url as query parameters, but there still may be request attributes to deal with. Forward if at all possible. --John Younis, Shahzaib wrote: In case of validation error, It gets forward to forward failure and xsl renders errors saved into request. but if set the redirect=true for forward failure then it forwards to given url but erase all attached requests it seems it issue as new request, is there any way I can redirect to specified url and also get the old attached request stuff. following is configuration I'm using. action path=/logon scope=request name=logonForm validate=true type=mapper.admin.action.LogonAction input=failure forward name=success path=logon.dox redirect=true / forward name=failure path=dspLogon.do redirect=false / /action controller !--Set to true if you want the input attribute of action elements to be the name of a local or global ActionForward, which will then be used to calculate the ultimate URL. Set to false (the default) to treat the input parameter of action elements as a module-relative path to the resource to be used as the input form. Since Struts 1.1. -- set-property property=inputForward value=true / /controller Thanks, Shahzaib - 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: How to redirect to http://www.cnn.com from Struts Action?
http://www.mail-archive.com/[EMAIL PROTECTED]/msg40448.html --- J. Jason Zhou [EMAIL PROTECTED] wrote: It seems Struts ALWAYS prefix myapp context so it becomes /myapp/http://www.cnn.com -- Best Regards, J. Jason Zhou Business Intelligence Platform Division (BIP), R D, SAS Institute, 100 SAS Campus Dr. Cary, North Carolina 27513-8617 Voice: 919-531-0568(O) Email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to redirect to http://www.cnn.com from Struts Action?
I believe this will work declare this forward as a global or local forward forward name=cnn path=http://www.cnn.com; redirect=true/ from an action do: return mapping.findForward(cnn) or from a jsp call logic:forward name=cnn/ (has to be global for jsp one to work. Hope this helps. Doug On Fri, 2003-06-13 at 15:46, J. Jason Zhou wrote: It seems Struts ALWAYS prefix myapp context so it becomes /myapp/http://www.cnn.com -- Best Regards, J. Jason Zhou Business Intelligence Platform Division (BIP), R D, SAS Institute, 100 SAS Campus Dr. Cary, North Carolina 27513-8617 Voice: 919-531-0568(O) Email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Doug Bryant ICF Consulting Software Engineer phone: 843.760.3635 fax: 843.207.5444 email: [EMAIL PROTECTED] [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to REDIRECT?
Dunno why you're doing this, but you can tell the browser to refresh with a different URL in the meta tag: head meta http-equiv=Refresh content=30; URL=http:///www.myserver.com/someURL.do; /head Note that the URL must be an absolute URL, not a relative one. You'll prolly have to use a scriplet to create the absolute URL in the header. --joe -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 30, 2003 10:16 AM To: [EMAIL PROTECTED] Subject: How to REDIRECT? Hello, how to say to IE (browser) to change url? use redirect instead forward. one Action class call another as it defined in struts-config.xml - SaveAction -- ListAction action path=/save type=SaveAction name=editForm scope=request validate=true input=/Edit.jsp forward name=found path=/list.do/ /action !-- List -- action path=/list type=ListAction name=listForm scope=request validate=false input=/List.jsp forward name=success path=List.jsp/ /action the List.jsp has refresh meta tag and it need to call list.do, but IE still has old save.do instead of it. what I need to do to replace that? tnx Best Regards. Michael. - 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: How to REDIRECT?
try specifying forward name=success path=List.jsp redirect=true/ KT -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 30, 2003 1:16 PM To: [EMAIL PROTECTED] Subject: How to REDIRECT? Hello, how to say to IE (browser) to change url? use redirect instead forward. one Action class call another as it defined in struts-config.xml - SaveAction -- ListAction action path=/save type=SaveAction name=editForm scope=request validate=true input=/Edit.jsp forward name=found path=/list.do/ /action !-- List -- action path=/list type=ListAction name=listForm scope=request validate=false input=/List.jsp forward name=success path=List.jsp/ /action the List.jsp has refresh meta tag and it need to call list.do, but IE still has old save.do instead of it. what I need to do to replace that? tnx Best Regards. Michael. - 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: How to Redirect ???
Isn't there is a contextrelative attribute in the forward/ tag where you can set to 'true'? -Original Message- From: wolfgang [mailto:[EMAIL PROTECTED]] Sent: Monday, November 18, 2002 8:15 AM To: [EMAIL PROTECTED] Subject: How to Redirect ??? Hi there, I wanna make users redirect(not forward) to http://www.yahoo.com , but cannot make it... I added the following elements in the struts-config.xml global-forwards forward name=finish path=http://www.yahoo.com; redirect=true / /global-forwards and the following code in the execute method of the Action class. return mapping.findForward(finish); but It doesn't work. Struts attempts to make users redirect to the /test_webapp/http://www.yahoo.com; where /test_webapp is the name of my web application. How can I make it ?? Thanks in advance. wolfgang- -- wolfgang [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: How to Redirect ???
That's not what the contextRelative attribute means. Here's the snippet from the 1.1 DTD: contextRelative Set this to true if, in a modular application, the path attribute starts with a slash / and should be considered relative to the entire web application rather than the module. Since Struts 1.1. [false] The redirect attribute only determines if RequestDispatcher.forward or HttpServletResponse.sendRedirect is used. In either case, the path attribute is always either module-relative or context-relative. I think you'll have to use something like HttpServletResponse.sendRedirect directly in your Action to redirect outside your app's context. Quoting Trieu, Danny [EMAIL PROTECTED]: Isn't there is a contextrelative attribute in the forward/ tag where you can set to 'true'? -Original Message- From: wolfgang [mailto:[EMAIL PROTECTED]] Sent: Monday, November 18, 2002 8:15 AM To: [EMAIL PROTECTED] Subject: How to Redirect ??? Hi there, I wanna make users redirect(not forward) to http://www.yahoo.com , but cannot make it... I added the following elements in the struts-config.xml global-forwards forward name=finish path=http://www.yahoo.com; redirect=true / /global-forwards and the following code in the execute method of the Action class. return mapping.findForward(finish); but It doesn't work. Struts attempts to make users redirect to the /test_webapp/http://www.yahoo.com; where /test_webapp is the name of my web application. How can I make it ?? Thanks in advance. wolfgang- -- wolfgang [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: How to Redirect ???
Wolfgang, Redirect outside of an app can be done a number of ways. One suggestion: Map your redirect to a class that creates the forwardURL. Put the forwardURL into request scope. Create a JSP that does nothing but the redirect. Map to it in struts-config. use the jsp:usebean and meta http_equiv tag to perform the external redirect. The advantage of this method is logging which can be done in the class and you have no context other than what you specify in the meta http-equiv tag. Brian - Original Message - From: Kris Schneider [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, November 18, 2002 11:58 AM Subject: Re: How to Redirect ??? That's not what the contextRelative attribute means. Here's the snippet from the 1.1 DTD: contextRelative Set this to true if, in a modular application, the path attribute starts with a slash / and should be considered relative to the entire web application rather than the module. Since Struts 1.1. [false] The redirect attribute only determines if RequestDispatcher.forward or HttpServletResponse.sendRedirect is used. In either case, the path attribute is always either module-relative or context-relative. I think you'll have to use something like HttpServletResponse.sendRedirect directly in your Action to redirect outside your app's context. Quoting Trieu, Danny [EMAIL PROTECTED]: Isn't there is a contextrelative attribute in the forward/ tag where you can set to 'true'? -Original Message- From: wolfgang [mailto:[EMAIL PROTECTED]] Sent: Monday, November 18, 2002 8:15 AM To: [EMAIL PROTECTED] Subject: How to Redirect ??? Hi there, I wanna make users redirect(not forward) to http://www.yahoo.com , but cannot make it... I added the following elements in the struts-config.xml global-forwards forward name=finish path=http://www.yahoo.com; redirect=true / /global-forwards and the following code in the execute method of the Action class. return mapping.findForward(finish); but It doesn't work. Struts attempts to make users redirect to the /test_webapp/http://www.yahoo.com; where /test_webapp is the name of my web application. How can I make it ?? Thanks in advance. wolfgang- -- wolfgang [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: How to Redirect ???
Another thought is that you could still use a forward element to define an external resource: global-forwards forward name=external.yahoo path=http://www.yahoo.com/ forward name=external.sun path=http://www.sun.com/ /global-forwards Then, in an Action: ActionForward yahoo = mapping.findForward(external.yahoo); response.sendRedirect(response.encodeRedirectURL(yahoo.getPath())); Never tried it, but seems like it should work. Just understand that those forwards can't be used by the standard Struts machinery. Quoting Brian Hickey [EMAIL PROTECTED]: Wolfgang, Redirect outside of an app can be done a number of ways. One suggestion: Map your redirect to a class that creates the forwardURL. Put the forwardURL into request scope. Create a JSP that does nothing but the redirect. Map to it in struts-config. use the jsp:usebean and meta http_equiv tag to perform the external redirect. The advantage of this method is logging which can be done in the class and you have no context other than what you specify in the meta http-equiv tag. Brian - Original Message - From: Kris Schneider [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, November 18, 2002 11:58 AM Subject: Re: How to Redirect ??? That's not what the contextRelative attribute means. Here's the snippet from the 1.1 DTD: contextRelative Set this to true if, in a modular application, the path attribute starts with a slash / and should be considered relative to the entire web application rather than the module. Since Struts 1.1. [false] The redirect attribute only determines if RequestDispatcher.forward or HttpServletResponse.sendRedirect is used. In either case, the path attribute is always either module-relative or context-relative. I think you'll have to use something like HttpServletResponse.sendRedirect directly in your Action to redirect outside your app's context. Quoting Trieu, Danny [EMAIL PROTECTED]: Isn't there is a contextrelative attribute in the forward/ tag where you can set to 'true'? -Original Message- From: wolfgang [mailto:[EMAIL PROTECTED]] Sent: Monday, November 18, 2002 8:15 AM To: [EMAIL PROTECTED] Subject: How to Redirect ??? Hi there, I wanna make users redirect(not forward) to http://www.yahoo.com , but cannot make it... I added the following elements in the struts-config.xml global-forwards forward name=finish path=http://www.yahoo.com; redirect=true / /global-forwards and the following code in the execute method of the Action class. return mapping.findForward(finish); but It doesn't work. Struts attempts to make users redirect to the /test_webapp/http://www.yahoo.com; where /test_webapp is the name of my web application. How can I make it ?? Thanks in advance. wolfgang- -- wolfgang [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to Redirect ???
Hi all For what it is worth. This works in an Action: Good for building dynamic forwards StringBuffer sb = new StringBuffer(); sb.append(http://www.someurl/actionpath?;); sb.append(customer= + customer.getName()); sb.append(address= + customer.getAddress()); etc.. ActionForward forward = mapping.findForward(success); forward.setPath(sb.toString); forward.setRedirect(true); mapping.addForward(forward); return forward; -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED]] Sent: 18 November 2002 17:47 To: Struts Users Mailing List Subject: Re: How to Redirect ??? Another thought is that you could still use a forward element to define an external resource: global-forwards forward name=external.yahoo path=http://www.yahoo.com/ forward name=external.sun path=http://www.sun.com/ /global-forwards Then, in an Action: ActionForward yahoo = mapping.findForward(external.yahoo); response.sendRedirect(response.encodeRedirectURL(yahoo.getPath())); Never tried it, but seems like it should work. Just understand that those forwards can't be used by the standard Struts machinery. Quoting Brian Hickey [EMAIL PROTECTED]: Wolfgang, Redirect outside of an app can be done a number of ways. One suggestion: Map your redirect to a class that creates the forwardURL. Put the forwardURL into request scope. Create a JSP that does nothing but the redirect. Map to it in struts-config. use the jsp:usebean and meta http_equiv tag to perform the external redirect. The advantage of this method is logging which can be done in the class and you have no context other than what you specify in the meta http-equiv tag. Brian - Original Message - From: Kris Schneider [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, November 18, 2002 11:58 AM Subject: Re: How to Redirect ??? That's not what the contextRelative attribute means. Here's the snippet from the 1.1 DTD: contextRelative Set this to true if, in a modular application, the path attribute starts with a slash / and should be considered relative to the entire web application rather than the module. Since Struts 1.1. [false] The redirect attribute only determines if RequestDispatcher.forward or HttpServletResponse.sendRedirect is used. In either case, the path attribute is always either module-relative or context-relative. I think you'll have to use something like HttpServletResponse.sendRedirect directly in your Action to redirect outside your app's context. Quoting Trieu, Danny [EMAIL PROTECTED]: Isn't there is a contextrelative attribute in the forward/ tag where you can set to 'true'? -Original Message- From: wolfgang [mailto:[EMAIL PROTECTED]] Sent: Monday, November 18, 2002 8:15 AM To: [EMAIL PROTECTED] Subject: How to Redirect ??? Hi there, I wanna make users redirect(not forward) to http://www.yahoo.com , but cannot make it... I added the following elements in the struts-config.xml global-forwards forward name=finish path=http://www.yahoo.com; redirect=true / /global-forwards and the following code in the execute method of the Action class. return mapping.findForward(finish); but It doesn't work. Struts attempts to make users redirect to the /test_webapp/http://www.yahoo.com; where /test_webapp is the name of my web application. How can I make it ?? Thanks in advance. wolfgang- -- wolfgang [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to Redirect ???
By the way, you can't do that in 1.1. After startup the configutation is frozen (and ActionMapping.addForward doesn't exist anymore). In 1.0.2, Struts will examine the redirect attribute and, if it's set to true, will then examine the path attribute to see if it starts with a /. Only if it does is the context prepended to the path. So, in 1.0.2 it looks like Struts behaves the way wolfgang expected. In 1.1, however, the path attribute is interpreted as strictly module- or context-relative. In other words, the context is *always* prepended to the path. I'm not sure if this was driven by the sub-module feature, but it's one of those places where the behavior has changed. Quoting David Bolsover [EMAIL PROTECTED]: Hi all For what it is worth. This works in an Action: Good for building dynamic forwards StringBuffer sb = new StringBuffer(); sb.append(http://www.someurl/actionpath?;); sb.append(customer= + customer.getName()); sb.append(address= + customer.getAddress()); etc.. ActionForward forward = mapping.findForward(success); forward.setPath(sb.toString); forward.setRedirect(true); mapping.addForward(forward); return forward; -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED]] Sent: 18 November 2002 17:47 To: Struts Users Mailing List Subject: Re: How to Redirect ??? Another thought is that you could still use a forward element to define an external resource: global-forwards forward name=external.yahoo path=http://www.yahoo.com/ forward name=external.sun path=http://www.sun.com/ /global-forwards Then, in an Action: ActionForward yahoo = mapping.findForward(external.yahoo); response.sendRedirect(response.encodeRedirectURL(yahoo.getPath())); Never tried it, but seems like it should work. Just understand that those forwards can't be used by the standard Struts machinery. Quoting Brian Hickey [EMAIL PROTECTED]: Wolfgang, Redirect outside of an app can be done a number of ways. One suggestion: Map your redirect to a class that creates the forwardURL. Put the forwardURL into request scope. Create a JSP that does nothing but the redirect. Map to it in struts-config. use the jsp:usebean and meta http_equiv tag to perform the external redirect. The advantage of this method is logging which can be done in the class and you have no context other than what you specify in the meta http-equiv tag. Brian - Original Message - From: Kris Schneider [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, November 18, 2002 11:58 AM Subject: Re: How to Redirect ??? That's not what the contextRelative attribute means. Here's the snippet from the 1.1 DTD: contextRelative Set this to true if, in a modular application, the path attribute starts with a slash / and should be considered relative to the entire web application rather than the module. Since Struts 1.1. [false] The redirect attribute only determines if RequestDispatcher.forward or HttpServletResponse.sendRedirect is used. In either case, the path attribute is always either module-relative or context-relative. I think you'll have to use something like HttpServletResponse.sendRedirect directly in your Action to redirect outside your app's context. Quoting Trieu, Danny [EMAIL PROTECTED]: Isn't there is a contextrelative attribute in the forward/ tag where you can set to 'true'? -Original Message- From: wolfgang [mailto:[EMAIL PROTECTED]] Sent: Monday, November 18, 2002 8:15 AM To: [EMAIL PROTECTED] Subject: How to Redirect ??? Hi there, I wanna make users redirect(not forward) to http://www.yahoo.com , but cannot make it... I added the following elements in the struts-config.xml global-forwards forward name=finish path=http://www.yahoo.com; redirect=true / /global-forwards and the following code in the execute method of the Action class. return mapping.findForward(finish); but It doesn't work. Struts attempts to make users redirect to the /test_webapp/http://www.yahoo.com; where /test_webapp is the name of my web application. How can I make it ?? Thanks in advance. wolfgang- -- wolfgang [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL
RE: How to Redirect ???
This is a known issue and is currently being worked on in 1.1. David From: Kris Schneider [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: How to Redirect ??? Date: Mon, 18 Nov 2002 14:11:19 -0500 By the way, you can't do that in 1.1. After startup the configutation is frozen (and ActionMapping.addForward doesn't exist anymore). In 1.0.2, Struts will examine the redirect attribute and, if it's set to true, will then examine the path attribute to see if it starts with a /. Only if it does is the context prepended to the path. So, in 1.0.2 it looks like Struts behaves the way wolfgang expected. In 1.1, however, the path attribute is interpreted as strictly module- or context-relative. In other words, the context is *always* prepended to the path. I'm not sure if this was driven by the sub-module feature, but it's one of those places where the behavior has changed. Quoting David Bolsover [EMAIL PROTECTED]: Hi all For what it is worth. This works in an Action: Good for building dynamic forwards StringBuffer sb = new StringBuffer(); sb.append(http://www.someurl/actionpath?;); sb.append(customer= + customer.getName()); sb.append(address= + customer.getAddress()); etc.. ActionForward forward = mapping.findForward(success); forward.setPath(sb.toString); forward.setRedirect(true); mapping.addForward(forward); return forward; -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED]] Sent: 18 November 2002 17:47 To: Struts Users Mailing List Subject: Re: How to Redirect ??? Another thought is that you could still use a forward element to define an external resource: global-forwards forward name=external.yahoo path=http://www.yahoo.com/ forward name=external.sun path=http://www.sun.com/ /global-forwards Then, in an Action: ActionForward yahoo = mapping.findForward(external.yahoo); response.sendRedirect(response.encodeRedirectURL(yahoo.getPath())); Never tried it, but seems like it should work. Just understand that those forwards can't be used by the standard Struts machinery. Quoting Brian Hickey [EMAIL PROTECTED]: Wolfgang, Redirect outside of an app can be done a number of ways. One suggestion: Map your redirect to a class that creates the forwardURL. Put the forwardURL into request scope. Create a JSP that does nothing but the redirect. Map to it in struts-config. use the jsp:usebean and meta http_equiv tag to perform the external redirect. The advantage of this method is logging which can be done in the class and you have no context other than what you specify in the meta http-equiv tag. Brian - Original Message - From: Kris Schneider [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, November 18, 2002 11:58 AM Subject: Re: How to Redirect ??? That's not what the contextRelative attribute means. Here's the snippet from the 1.1 DTD: contextRelative Set this to true if, in a modular application, the path attribute starts with a slash / and should be considered relative to the entire web application rather than the module. Since Struts 1.1. [false] The redirect attribute only determines if RequestDispatcher.forward or HttpServletResponse.sendRedirect is used. In either case, the path attribute is always either module-relative or context-relative. I think you'll have to use something like HttpServletResponse.sendRedirect directly in your Action to redirect outside your app's context. Quoting Trieu, Danny [EMAIL PROTECTED]: Isn't there is a contextrelative attribute in the forward/ tag where you can set to 'true'? -Original Message- From: wolfgang [mailto:[EMAIL PROTECTED]] Sent: Monday, November 18, 2002 8:15 AM To: [EMAIL PROTECTED] Subject: How to Redirect ??? Hi there, I wanna make users redirect(not forward) to http://www.yahoo.com , but cannot make it... I added the following elements in the struts-config.xml global-forwards forward name=finish path=http://www.yahoo.com; redirect=true / /global-forwards and the following code in the execute method of the Action class. return mapping.findForward(finish); but It doesn't work. Struts attempts to make users redirect to the /test_webapp/http://www.yahoo.com; where /test_webapp is the name of my web application. How can I make it ?? Thanks in advance. wolfgang- -- wolfgang [EMAIL PROTECTED] -- To unsubscribe, e-mail
RE: How to redirect to login page
[EMAIL PROTECTED] (Reid Pinchback) wrote: Another alternative is used by the workflow extension listed on the Struts resources page. You can create a base action class that does the checking in its perform method, then calls some other method provided by the concrete subclass to do the normal work if the user is already logged in. In that extension package the performAction method is called. I use this pattern (its really just a template method pattern), but I just call it perform() since I pass an extra parameter which is the users credentials object to distinguish it from the original perform. I then mark the original perform final and the new perform abstract and then derived classes must conform to the pattern. Other ideas: have a method minLogonLevel() which derived classes can override to indicate the necessary logon level required for this action. Example use is to have AdministratorAction base class which defines this and then derive administrator actions from it. You can use a similar template method pattern to factor out repetitive database access code, e.g. closing the connection in finally and catching SQLException. Duncan Harris ~~~ Hartford, Cheshire, U.K., Tel: 07968 060418 Looking for STRUTS contract work in the U.K. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: How to redirect to login page
Reid Pinchback wrote: Another alternative is used by the workflow extension listed on the Struts resources page. You can create a base action class that does the checking in its perform method, then calls some other method provided by the concrete subclass to do the normal work if the user is already logged in. In that extension package the performAction method is called. What about extending ActionServlet and put authentification code in the processPreprocess() method ? (http://www.mail-archive.com/struts-user@jakarta.apache.org/msg15542.html) Javadoc of this function is : /** * General purpose preprocessing hook that can be overridden to support * application specific preprocessing activity. This hook can examine * and/or modify the properties of the request and response objects, and * optionally complete the response if it wishes. * p * The default implementation does nothing. */ protected boolean processPreprocess(HttpServletRequest request, HttpServletResponse response) -- C. Bouessay -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: How to redirect to login page
A common approach is to (1) Route all control through an Action, even if all the Action does is forward to the JSP. (2) Have the Action check for a session property or a cookie which indicates whether they have logged in. For (1), a single continue Action can be used for any page that doesn't require other preprocessing. return mapping.findForward(Tokens.CONTINUE); (1) is also an essential element in the new support for modular applications that was introduced in the nightly build last week. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ Sivasankaran, Vijay wrote: Hi, I have three jsp which uses the struts framework first.jsp-second.jsp-third.jsp the second.jsp and third.jsp use the action form data of the first.jsp using html:text tag. All these works fine. But this poses a problem. I want the user to be redirected to first.jsp whenever they access second.jsp and third.jsp directly without going through first.jsp. At present when i access second.jsp or third.jsp directly it errors out. Is there a graceful way in struts to redirect it to first.jsp? Thanks Vijay -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to redirect to login page
Set a session variable in first.jsp, then create a custom tag that checks for that session variable and place the custom tag in second.jsp and third.jsp. If the session variable isn't there, forward to first.jsp. The sample app does this exact process with the CheckLogonTag. Go look at how that works. Jeff -Original Message- From: Sivasankaran, Vijay [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 24, 2002 10:18 AM To: '[EMAIL PROTECTED]' Subject: How to redirect to login page Hi, I have three jsp which uses the struts framework first.jsp-second.jsp-third.jsp the second.jsp and third.jsp use the action form data of the first.jsp using html:text tag. All these works fine. But this poses a problem. I want the user to be redirected to first.jsp whenever they access second.jsp and third.jsp directly without going through first.jsp. At present when i access second.jsp or third.jsp directly it errors out. Is there a graceful way in struts to redirect it to first.jsp? Thanks Vijay -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to redirect to login page
Jeff Oberlander [EMAIL PROTECTED] wrote: Set a session variable in first.jsp, then create a custom tag that checks for that session variable and place the custom tag in second.jsp and third.jsp. If the session variable isn't there, forward to first.jsp. The sample app does this exact process with the CheckLogonTag. Go look at how that works. Another alternative is used by the workflow extension listed on the Struts resources page. You can create a base action class that does the checking in its perform method, then calls some other method provided by the concrete subclass to do the normal work if the user is already logged in. In that extension package the performAction method is called. I like the architecture used by this package, but I don't like some aspects of the implementation. It invalidates the session if the user hasn't yet logged in (which is a serious pain if the user had logged in, but the session timed out), and it doesn't really have any support for looping back to where you started from by saving and restoring form data. The package also doesn't contain any licensing info, which tends to make the corporate legal eagles tres nervous. Reid - Do You Yahoo!? Yahoo! Auctions Great stuff seeking new owners! Bid now!
RE: How to redirect user to the protected page after forced login
Standard J2EE/WEB based security should do the job. I have this running nicely with Orion server. From my public page, I put a link called Login to the index.html in the protected area. If the user is not authenticated, he/she is first taken to the Logon page specified by the configuration in WEB-INF/web.xml, and then, after authentication is taken to the private/index.jsp they were going to. In fact, if the user bookmarks some private page in his browser, and then later attempts to go to that page, the authentication kicks in, and properly forwards to that page after success. Seems to me it should work the same in all J2EE compliant servers. -AP_ -Original Message- From: Eric Ma [mailto:[EMAIL PROTECTED]] Sent: Friday, January 18, 2002 12:51 PM To: [EMAIL PROTECTED] Subject: How to redirect user to the protected page after forced login Scenario: I need to implement a security scheme so that when a user tries to access a secure page without logging in first, (s)he is sent to the login form page. Upon successful authentication, the original page which the user tried to access. App server is WebLogic 6.1 SP1, as a result, I cannot: 1. Put the JSP pages under /WEB-INF to let the app server take care of protecting them 2. Use web container-based security scheme because in WebLogic it always send you to the welcome page after logging in, not the page the user wants to go to So far I have done the following: 1. To protect the JSP pages from being bookmarked and accessed without logging in, I use a CheckLogonTag on each JSP, redirecting the user to the login form page if (s)he has not logged in. I pass the action path of the JSP page around as a HTTP request parameter so that after authentication I know whether to send the user 2. To protect the Action URI (/do/action1 or /action1.do), I extend the ActionServlet and override the processActionPerform method to check the session variable and redirect to the login form page as necessary I hate to duplicate the security checking logic in 2 places but I haven't figured out a way to consolidate them. Can anyone share some good ideas on how to implement the security requirement I described above using Struts and WebLogic 6.1? Thanks. Eric Ma -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: How to redirect to the input jsp page from the formbean's validate method instead of populating ActionErrors.
On Wed, 28 Mar 2001, Suriyanarayanan, Senthil Kumar wrote: Hello, How do I redirect to the input jsp page from the formbean's validate method instead of populating ActionErrors. I knew redirecting from the perform method of the Action object, wondering is it possible to simulate the same from the validate method. Redirecting directly from the validate() method would violate the "separation of concerns" philosophy that underlies the MVC architecture of Struts. In particular, it would require your form bean to know where to redirect *to* (in other words, which page it was used on), which is information that only the controller should really need. It would also cause problems if the same form bean were used on multiple forms. The purpose of the validate() method is to do two simple things: * Determine whether there are any errors in the request parameters * If so, create ActionError instances that describe those errors Whatever happens next is up to the controller servlet (and is ultimately determined by what you've configured in the struts-config.xml file). Thanks in advance, Senthil Kumar.S Craig McClanahan
Re: How to redirect to the input jsp page from the formbean's validat emethod instead of populating ActionErrors.
Hi Senthil, Sorry for answering a question with a question. How do you redirect errors from perform to the input page without ActionErrors? Best regards Suresh "Suriyanarayanan, Senthil Kumar" senthilkumar.suriyanarayanan@capitTo: [EMAIL PROTECTED] alone.com cc: Subject: How to redirect to the input jsp 03/29/01 06:39 AM page from the formbean's validat e method instead Please respond to struts-user of populating ActionErrors. Hello, How do I redirect to the input jsp page from the formbean's validate method instead of populating ActionErrors. I knew redirecting from the perform method of the Action object, wondering is it possible to simulate the same from the validate method. Thanks in advance, Senthil Kumar.S ** The Information transmitted herewith is sensitive information intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.
RE: How to redirect to the input jsp page from the formbean's validat e method instead of populating ActionErrors.
We can use mapping.getInput() to forward to the "input" page. -- Jacob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 29, 2001 4:18 AM To: [EMAIL PROTECTED] Subject: Re: How to redirect to the input jsp page from the formbean's validat e method instead of populating ActionErrors. Hi Senthil, Sorry for answering a question with a question. How do you redirect errors from perform to the input page without ActionErrors? Best regards Suresh "Suriyanarayanan, Senthil Kumar" senthilkumar.suriyanarayanan@capitTo: [EMAIL PROTECTED] alone.com cc: Subject: How to redirect to the input jsp 03/29/01 06:39 AM page from the formbean's validat e method instead Please respond to struts-user of populating ActionErrors. Hello, How do I redirect to the input jsp page from the formbean's validate method instead of populating ActionErrors. I knew redirecting from the perform method of the Action object, wondering is it possible to simulate the same from the validate method. Thanks in advance, Senthil Kumar.S ** The Information transmitted herewith is sensitive information intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.