Hi Luca,
If you just need to do this with servlets you can either use a 
sendRedirect or a RequestDispatcher. SendRedirect tells the user to 
request another page, in oppose to a RequestDispatcher which lets 
another Servlet return the data requested. The best way (if you need to 
use the data the client posts) is to use a RequestDispatcher.

Try something like:

RequestDispatcher anotherServlet = 
servletContext.getRequestDispatcher("/ServletB");
anotherServlet.forward(req, res);

Please remeber that you cannot send any other to the client before 
sending forward() to a RequestDispatcher. I. e. you cannot setting the 
contenttype before you seding forward(),

Using a sendRedirect is even simpler (if you do NOT need to use the data 
posted):

res.sendRedirect("/ServletB");

If you need to use the data the client posts to you, you need to setting 
some shared variables to theese values - for example using Session 
variables. But I think the best sollution to your problem is to go with 
the RequestDispatcher.

Hope this helps!


Markus

On Friday, May 31, 2002, at 01:23 PM, Luca Ventura wrote:

> Hello everybody!
>
> I excuse with all people of the forum is the question I am posting is a
> little off-topic because it concerns also Internet Information Services
> (IIS) Web Server, but
> I didn't find any forum or source data where to retrieve the following
> information that I need absolutely:-(
>
> I have the following problem: I would like to redirect all the data 
> sent to
> url A to url B.  For example I would like that when my Web Server 
> detects a
> request directed to url: http://mydomain/servletA (or
> https://mydomain/servletA using https protocol)redirects it to url
> http://mydomain/servletB (or https://mydomain/servletB) . In this case 
> I am
> redirecting a request from servlet A to servlet B.
>
> I would like to know IF and HOW I can do it in the following Web 
> Servers:
>
> 1)Internet Information Services (IIS)
> 2)Apache Tomcat
>
> I need urgently to know the first point because now I have IIS installed
> on my Win 2000 machine to run my ASP pages...and only in a second time I
> think to convert my ASP pages in JSP pages passing to Apache Tomcat Web
> Server. I know I can use
> Apache Tomcat like a plug-in of IIS to run JSP pages and servlets but I
> would like to obtain the best performance possible from my Web 
> applications:
> so I would like to use only one Web Server and not to mix ASP and JSP
> pages....
>
> I hope someone HELP me....
>
> Thanks everybody in advance!
>
>                                             Luca
>
>
> --
> To unsubscribe, e-mail:   <mailto:tomcat-user-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:tomcat-user-
> [EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to