You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Prasannna <pr...@emagia.com> on 2001/06/04 15:56:06 UTC

Issues with sendRedirect/forward() in Tomcat+IIS

Hi!

We could successfully integrate Tomcat with IIS except for one issue.

The prob. is as follows:

We have the following dir. structure under webapps.

icollect
   customer    (Our application front end grouped under following dirs.)
      index.html   (this is the only file under customer dir.)
      jsp          (jsp files)
      images       (images)
      js           (java scripts)
      flash        (flash files)
   web-inf
      classes
         com structure (We have Servlets under this path)
         web.xml


We defined a new context "icollect" in server.xml as follows:
           <Context path="/icollect"
	                    docBase="webapps/icollect"
	                    crossContext="false"
	                    debug="0"
	                    reloadable="true" >
        </Context>


We mounted the icollect context to the ajp12 worker as follows:
/icollect/*=ajp12


We give the following url in the browser:

http://localhost/icollect/customer/index.html

This displays login screen and once the user enters the login/password, a
controller
LoginController is invoked which is under
classes\com\xyz\customer\controller structure.

On successful login, the LoginController invokes res.sendRedirect as
follows:
    res.sendRedirect(StartupServlet.JSP_URL + "Home.jsp");

The JSP_URL is defined in a parameter file as is as follows ->
/icollect/customer/jsp/

This perfectly works fine.

On the home page, we have few tabs and on click of which a Servlet is called
and a new
page gets be displayed.

Let me take an example here:
We have a tab/button called Statement on click of which InvoiceController is
called.

The servlet url that is formed on click of this is as follows:
http://localhost/icollect/servlet/com.xyz.customer.controller.InvoiceControl
ler?<someparameters>

This servlet processes the request and calls forward() to throw a new page
to the
browser.

As we know the following statements are used:
   RequestDispatcher rd =
   getServletContext().getRequestDispatcher(StartupServlet.JSP_URL +
"InvoiceList.jsp");
   rd.forward(req, res);

This is where the problem is:
   The getServletContext(), we suppose is returning the context which is
'/icollect
   and the JSP_URL (/icollect/customer/jsp) is added to the context thus
making the
   entire path /icollect/icollect/customer/jsp, thus creating the problem.

The same code worked very much fine when the application was run on Tomcat
3.2.2 stand-alone
format, on the java webserver 2.0.  But once Tomcat got integrated with IIS,
the prob. started.

This requires us to maintain two different parameters, one that would serve
forward() and
the other that would serve sendRedirect.

Somehow, we feel this shouldn't be the case.

Could u pl. throw some light on this and help us out to resolve this.

Waiting to hear from u at the earliest.

Pl. let us know if u require any additional information reg. this.

Thanking you in advance.

Regards
Prasanna Krishna