redirect from Servlet
Hello, I have a packaged servlet (com.mypackage.servlets;) in WEB-INF\classes\com\mypackage\servlets, where it performs its logic dutifully. From the servlet I wish to redirect back to the JSP that called it. Currently the JSP origin cannot be found (404). I have tried all manner of variations of path: res.sendRedirect("addAgent.jsp"); including a fully formed URL (local and HTTP). How do I redirect to the desired file please? Thanks Paul. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: redirect from Servlet
Try this getServletConfig().getServletContext().getRequestDispatcher("/xxx.jsp"). forward(request, response); - Original Message - From: "Paul Wallace" <[EMAIL PROTECTED]> To: "Tomcat Developers List" <[EMAIL PROTECTED]> Sent: Thursday, June 26, 2003 11:21 AM Subject: redirect from Servlet > Hello, > I have a packaged servlet (com.mypackage.servlets;) in > WEB-INF\classes\com\mypackage\servlets, where it performs its logic > dutifully. From the servlet I wish to redirect back to the JSP that > called it. Currently the JSP origin cannot be found (404). I have tried > all manner of variations of path: > > res.sendRedirect("addAgent.jsp"); > > including a fully formed URL (local and HTTP). How do I redirect to the > desired file please? > > Thanks > > Paul. > > - > 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: redirect from Servlet
Hi, thanks, I added the line. No 404 is present, but the servlet maintains, ie the browser is completely blank. What about the ("/xxx.jsp") path? Thanks Paul. Try this getServletConfig().getServletContext().getRequestDispatcher("/xxx.jsp"). forward(request, response); - Original Message - From: "Paul Wallace" <[EMAIL PROTECTED]> To: "Tomcat Developers List" <[EMAIL PROTECTED]> Sent: Thursday, June 26, 2003 11:21 AM Subject: redirect from Servlet > Hello, > I have a packaged servlet (com.mypackage.servlets;) in > WEB-INF\classes\com\mypackage\servlets, where it performs its logic > dutifully. From the servlet I wish to redirect back to the JSP that > called it. Currently the JSP origin cannot be found (404). I have tried > all manner of variations of path: > > res.sendRedirect("addAgent.jsp"); > > including a fully formed URL (local and HTTP). How do I redirect to the > desired file please? > > Thanks > > Paul. > > - > 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: redirect from Servlet
if your jsp is under $TOMCAT_HOME/webapps/admin/test/Test.jsp getServletConfig().getServletContext().getRequestDispatcher("/admin/test/Tes t.jsp").forward(request, response); thanx - Original Message - From: "Paul Wallace" <[EMAIL PROTECTED]> To: "Tomcat Developers List" <[EMAIL PROTECTED]> Sent: Thursday, June 26, 2003 11:37 AM Subject: RE: redirect from Servlet > Hi, thanks, >I added the line. No 404 is present, but the servlet maintains, ie > the browser is completely blank. What about the ("/xxx.jsp") path? > > Thanks > > Paul. > > Try this > getServletConfig().getServletContext().getRequestDispatcher("/xxx.jsp"). > forward(request, response); > > - Original Message - > From: "Paul Wallace" <[EMAIL PROTECTED]> > To: "Tomcat Developers List" <[EMAIL PROTECTED]> > Sent: Thursday, June 26, 2003 11:21 AM > Subject: redirect from Servlet > > > > Hello, > > I have a packaged servlet (com.mypackage.servlets;) in > > WEB-INF\classes\com\mypackage\servlets, where it performs its logic > > dutifully. From the servlet I wish to redirect back to the JSP that > > called it. Currently the JSP origin cannot be found (404). I have > tried > > all manner of variations of path: > > > > res.sendRedirect("addAgent.jsp"); > > > > including a fully formed URL (local and HTTP). How do I redirect to > the > > desired file please? > > > > Thanks > > > > Paul. > > > > - > > 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] > > > - > 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: redirect from Servlet
Howdy, Not quite. RequestDispatcher is relative to the context root, so /test/Test.jsp. But he wanted to use sendRedirect anyways, so you would do response.sendRedirect(request.getContextPath() + "Test.jsp"); Assuming Test.jsp is under the context root. Yoav Shapira --- Dayan Simon <[EMAIL PROTECTED]> wrote: > > if your jsp is under $TOMCAT_HOME/webapps/admin/test/Test.jsp > > getServletConfig().getServletContext().getRequestDispatcher("/admin/test/Tes > t.jsp").forward(request, response); > thanx > > - Original Message - > From: "Paul Wallace" <[EMAIL PROTECTED]> > To: "Tomcat Developers List" <[EMAIL PROTECTED]> > Sent: Thursday, June 26, 2003 11:37 AM > Subject: RE: redirect from Servlet > > > > Hi, thanks, > >I added the line. No 404 is present, but the servlet maintains, ie > > the browser is completely blank. What about the ("/xxx.jsp") path? > > > > Thanks > > > > Paul. > > > > Try this > > getServletConfig().getServletContext().getRequestDispatcher("/xxx.jsp"). > > forward(request, response); > > > > - Original Message - > > From: "Paul Wallace" <[EMAIL PROTECTED]> > > To: "Tomcat Developers List" <[EMAIL PROTECTED]> > > Sent: Thursday, June 26, 2003 11:21 AM > > Subject: redirect from Servlet > > > > > > > Hello, > > > I have a packaged servlet (com.mypackage.servlets;) in > > > WEB-INF\classes\com\mypackage\servlets, where it performs its logic > > > dutifully. From the servlet I wish to redirect back to the JSP that > > > called it. Currently the JSP origin cannot be found (404). I have > > tried > > > all manner of variations of path: > > > > > > res.sendRedirect("addAgent.jsp"); > > > > > > including a fully formed URL (local and HTTP). How do I redirect to > > the > > > desired file please? > > > > > > Thanks > > > > > > Paul. > > > > > > - > > > 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] > > > > > > - > > 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] > = Yoav Shapira [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]