tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prasannna" <>
Subject Issues with sendRedirect/forward() in Tomcat+IIS
Date Mon, 04 Jun 2001 13:56:06 GMT

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

The prob. is as follows:

We have the following dir. structure under webapps.

   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)
         com structure (We have Servlets under this path)

We defined a new context "icollect" in server.xml as follows:
           <Context path="/icollect"
	                    reloadable="true" >

We mounted the icollect context to the ajp12 worker as follows:

We give the following url in the browser:


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

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

The JSP_URL is defined in a parameter file as is as follows ->

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

The servlet url that is formed on click of this is as follows:

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

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

This is where the problem is:
   The getServletContext(), we suppose is returning the context which is
   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.

Prasanna Krishna

View raw message