Problems with sendredirect
Hi. I just has beginning to use the Tomcat, for programming in JSP. I have the 5.0 version. I make a web app that uses, in some jsp's files, the command response.sendRedirect. When i execute the pages locally in my computer, works fine, but, i if try to test the pages from another computer, i get an error. This is the way i was executed the sendRedirect for test in another machine, and always get an error: response.sendRedirect(http://localhost:8080/activation/obligatorios.jsp;) response.sendRedirect(http://192.168.1.137:8080/activation/obligatorios.jsp ) response.sendRedirect(http://mycomputer:8080/activation/obligatorios.jsp;) response.sendRedirect(/obligatorios.jsp) response.sendRedirect(activation/obligatorios.jsp) I think that could be some context problems because, for make the webapp structure, i copied one example webapp that comes with the tomcat, then i deleted and renamed those files and directories that i dont use (off course, the web-inf still exist) What can i do ? Is there is some file where i must configure the context of the webapp ? Thanks !! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problems with sendRedirect() on relative path
Hi I am tring to use the HttpServletResponse sendRedirect() method to show a static page but i can't use relative path only static path (which include the context).The problem occure because of the default '/servlet' prefix which is used on tomcat conf\servel.xml.This default prefix force that each accses to servlet will contain the /servlet on the URI. Does anyone know how to solve that ?
RE: problems with sendRedirect() on relative path
try using getContext() and getRequestDispatcher() and then include(req, res) you can set a context in the server.xml to point to a directory where you keep these static pages eg staticPages with the path set to c:\staticPages then using the config.getContext(/staticPages).getRequestDispatcher().include 'or forward' (request, response) will forward to the or include the static page this is not the same as redirect but it's just another suggestion that might help Phill -Original Message- From: Ofer Baranes [mailto:[EMAIL PROTECTED]] Sent: 06 June 2001 12:45 To: '[EMAIL PROTECTED]' Subject: problems with sendRedirect() on relative path Hi I am tring to use the HttpServletResponse sendRedirect() method to show a static page but i can't use relative path only static path (which include the context).The problem occure because of the default '/servlet' prefix which is used on tomcat conf\servel.xml.This default prefix force that each accses to servlet will contain the /servlet on the URI. Does anyone know how to solve that ?
Re: problems with sendRedirect() on relative path
Hi Ofer! You can specify a different context, that will not contain the /servlet prefix. The prefix is set by context. I don't think the suggestion that was sent before (RequestDispatcher) will work, since it's a static page. Un saludo, Alex. Ofer Baranes wrote: Hi I am tring to use the HttpServletResponse sendRedirect() method to show a static page but i can't use relative path only static path (which include the context).The problem occure because of the default '/servlet' prefix which is used on tomcat conf\servel.xml.This default prefix force that each accses to servlet will contain the /servlet on the URI. Does anyone know how to solve that ?
RE: problems with sendRedirect() on relative path
Alex , actually i just learnd that using the RequestDispatcher is a better solution since the response is for this request while redirct is creating new requestresponse. By the way the RequestDispatch is showing static pages. Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 06, 2001 12:43 PM To: [EMAIL PROTECTED] Subject: Re: problems with sendRedirect() on relative path Hi Ofer! You can specify a different context, that will not contain the /servlet prefix. The prefix is set by context. I don't think the suggestion that was sent before (RequestDispatcher) will work, since it's a static page. Un saludo, Alex. Ofer Baranes wrote: Hi I am tring to use the HttpServletResponse sendRedirect() method to show a static page but i can't use relative path only static path (which include the context).The problem occure because of the default '/servlet' prefix which is used on tomcat conf\servel.xml.This default prefix force that each accses to servlet will contain the /servlet on the URI. Does anyone know how to solve that ?
Re: problems with sendRedirect() on relative path
Interesting, didn't know that. Thanks, Alex. Ofer Baranes wrote: Alex , actually i just learnd that using the RequestDispatcher is a better solution since the response is for this request while redirct is creating new requestresponse. By the way the RequestDispatch is showing static pages. Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 06, 2001 12:43 PM To: [EMAIL PROTECTED] Subject: Re: problems with sendRedirect() on relative path Hi Ofer! You can specify a different context, that will not contain the /servlet prefix. The prefix is set by context. I don't think the suggestion that was sent before (RequestDispatcher) will work, since it's a static page. Un saludo, Alex. Ofer Baranes wrote: Hi I am tring to use the HttpServletResponse sendRedirect() method to show a static page but i can't use relative path only static path (which include the context).The problem occure because of the default '/servlet' prefix which is used on tomcat conf\servel.xml.This default prefix force that each accses to servlet will contain the /servlet on the URI. Does anyone know how to solve that ?