RE: RequestDispatcher.forward() to doc located on HTTP Server

2005-04-12 Thread Raghupathy,Gurumoorthy
Forward only works within a context 

-Original Message-
From: Ron Crayton [mailto:[EMAIL PROTECTED] 
Sent: 11 April 2005 19:36
To: tomcat-user@jakarta.apache.org
Subject: RequestDispatcher.forward() to doc located on HTTP Server


Is it possible to use Request.forward() to forward a request to an html
document located on an HTTP Server?
 
I'm using Tomcat 5.5.7 and Apache 2.0.
 
I have a document setting in the htdocs folder of Apache 2.0 that I'm trying
to forward to from an application deployed in Tomcat 5.5.7.
 
I have this context in my server.xml file:
 



 
I have this code in my app:
 
ServletContext context = getServletConfig().getServletContext();
String uri = request.getQueryString();

ServletContext foreignContext = context.getContext("/");
RequestDispatcher requestDispatcher =
foreignContext.getRequestDispatcher(uri);
requestDispatcher.forward(request, response);
 
The uri comes from the query string of the original request.
When the code runs it says that the requested resource is not available -
Error 404.
 
Am I trying to do something that's impossible?
 
Please help.
 
 


-
Do you Yahoo!?
 Yahoo! Small Business - Try our new resources site! 

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



Re: RequestDispatcher.forward() to doc located on HTTP Server

2005-04-11 Thread Mark Thomas
You might have better luck using a redirect. This should cause the 
client to request the alternate resource which Apache would then serve.

Mark
Ron Crayton wrote:
Is it possible to use Request.forward() to forward a request to an html document located on an HTTP Server?
 
I'm using Tomcat 5.5.7 and Apache 2.0.
 
I have a document setting in the htdocs folder of Apache 2.0 that I'm trying to forward to from an application deployed in Tomcat 5.5.7.
 
I have this context in my server.xml file:
 



 
I have this code in my app:
 
ServletContext context = getServletConfig().getServletContext();
String uri = request.getQueryString();

ServletContext foreignContext = context.getContext("/");
RequestDispatcher requestDispatcher = foreignContext.getRequestDispatcher(uri);
requestDispatcher.forward(request, response);
 
The uri comes from the query string of the original request.
When the code runs it says that the requested resource is not available - Error 404.
 
Am I trying to do something that's impossible?
 
Please help.
 
 

		
-
Do you Yahoo!?
 Yahoo! Small Business - Try our new resources site! 

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


RequestDispatcher.forward() to doc located on HTTP Server

2005-04-11 Thread Ron Crayton
Is it possible to use Request.forward() to forward a request to an html 
document located on an HTTP Server?
 
I'm using Tomcat 5.5.7 and Apache 2.0.
 
I have a document setting in the htdocs folder of Apache 2.0 that I'm trying to 
forward to from an application deployed in Tomcat 5.5.7.
 
I have this context in my server.xml file:
 



 
I have this code in my app:
 
ServletContext context = getServletConfig().getServletContext();
String uri = request.getQueryString();

ServletContext foreignContext = context.getContext("/");
RequestDispatcher requestDispatcher = foreignContext.getRequestDispatcher(uri);
requestDispatcher.forward(request, response);
 
The uri comes from the query string of the original request.
When the code runs it says that the requested resource is not available - Error 
404.
 
Am I trying to do something that's impossible?
 
Please help.
 
 


-
Do you Yahoo!?
 Yahoo! Small Business - Try our new resources site! 

Re: RequestDispatcher.forward: SOLVED

2005-03-03 Thread Lionel Farbos
Thanks to Tim and Remy for the answers; 

For more explanations for those who have the same problem like me :
- see bugs 23211 and 33831 on http://issues.apache.org/bugzilla/
- In my example, 
after ctx = ctx.getContext("/myNewContext");
but before dispatcher = ctx.getRequestDispatcher("/myNewServlet");

  I can verify if my context (ctx) is the good one (or the context root) thanks 
to :
ctx.getServletContextName() //if servlet API is 2.4
 or ctx.getInitParameterNames() return a initParameter present in my 
desired Context
 or ctx.getAttributeNames() return an attribute present in my desired 
Context
 or ctx.getRealPath("/myNewServlet") is a Path valid for my desired Context



On Wed, 2 Mar 2005 16:34:42 +0100
Lionel Farbos <[EMAIL PROTECTED]> wrote:

> Yes : it's my problem.
> 
> ctx.getContext("/myNewContext") always return a Context (even if myNewContext 
> is not deployed :-(
> and
> ctx.getRequestDispatcher("/myNewServlet") always return a dispatcher (even if 
> myNewServlet is not here :-(
> 
> So How can I avoid a 404 ?
> 
> On Wed, 02 Mar 2005 10:24:37 -0500
> Tim Funk <[EMAIL PROTECTED]> wrote:
> 
> > getRequestDispatcher() will always return a servlet. (The default servlet)
> > 
> > -Tim
> > 
> > Lionel Farbos wrote:
> > 
> > > Hi,
> > > (I work on Tomcat 5.0.30).
> > > 
> > > When my servlet (http://myVhost/proxy/testProxy) forward to another 
> > > servlet :
> > > try {
> > >   ServletContext ctx = getServletContext();
> > >   ctx = ctx.getContext("/myNewContext");
> > >   RequestDispatcher dispatcher = 
> > > ctx.getRequestDispatcher("/myNewServlet");
> > >   dispatcher.forward(request, response);
> > > } catch (Exception e) {e.printStackTrace();}
> > > 
> > > (in server.xml, in the Context /proxy of myVhost, I put 
> > > crossContext="true")
> > > 
> > > If the Context /myNewContext is deployed in myVhost, the HTTPresponse is :
> > > HTTP/1.1 200 OK
> > > ...
> > > response of myNewServlet
> > > 
> > > If the Context /myNewContext is not deployed, the HTTPresponse is :
> > > HTTP/1.1 404 /myNewServlet 
> > > :-(
> > > 
> > > 
> > > 1) In other servlets containers, I read that 
> > > ctx.getRequestDispatcher(...) returns null if the resource is absent.
> > > So, Why Tomcat reacts differently ? Is it a bug ?
> > > 
> > > 2) In my case, I'd want to forward to myNewServlet if it is present, BUT, 
> > > if it is absent, I'd want to call another url distant (with httpclient)...
> > > How can I do this with Tomcat ?
> > >  
> > 
> > -
> > 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: RequestDispatcher.forward: a bug?

2005-03-02 Thread Lionel Farbos
Yes : it's my problem.

ctx.getContext("/myNewContext") always return a Context (even if myNewContext 
is not deployed :-(
and
ctx.getRequestDispatcher("/myNewServlet") always return a dispatcher (even if 
myNewServlet is not here :-(

So How can I avoid a 404 ?

On Wed, 02 Mar 2005 10:24:37 -0500
Tim Funk <[EMAIL PROTECTED]> wrote:

> getRequestDispatcher() will always return a servlet. (The default servlet)
> 
> -Tim
> 
> Lionel Farbos wrote:
> 
> > Hi,
> > (I work on Tomcat 5.0.30).
> > 
> > When my servlet (http://myVhost/proxy/testProxy) forward to another servlet 
> > :
> > try {
> >   ServletContext ctx = getServletContext();
> >   ctx = ctx.getContext("/myNewContext");
> >   RequestDispatcher dispatcher = ctx.getRequestDispatcher("/myNewServlet");
> >   dispatcher.forward(request, response);
> > } catch (Exception e) {e.printStackTrace();}
> > 
> > (in server.xml, in the Context /proxy of myVhost, I put crossContext="true")
> > 
> > If the Context /myNewContext is deployed in myVhost, the HTTPresponse is :
> > HTTP/1.1 200 OK
> > ...
> > response of myNewServlet
> > 
> > If the Context /myNewContext is not deployed, the HTTPresponse is :
> > HTTP/1.1 404 /myNewServlet 
> > :-(
> > 
> > 
> > 1) In other servlets containers, I read that ctx.getRequestDispatcher(...) 
> > returns null if the resource is absent.
> > So, Why Tomcat reacts differently ? Is it a bug ?
> > 
> > 2) In my case, I'd want to forward to myNewServlet if it is present, BUT, 
> > if it is absent, I'd want to call another url distant (with httpclient)...
> > How can I do this with Tomcat ?
> >  
> 
> -
> 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: RequestDispatcher.forward: a bug?

2005-03-02 Thread Tim Funk
getRequestDispatcher() will always return a servlet. (The default servlet)
-Tim
Lionel Farbos wrote:
Hi,
(I work on Tomcat 5.0.30).
When my servlet (http://myVhost/proxy/testProxy) forward to another servlet :
try {
  ServletContext ctx = getServletContext();
  ctx = ctx.getContext("/myNewContext");
  RequestDispatcher dispatcher = ctx.getRequestDispatcher("/myNewServlet");
  dispatcher.forward(request, response);
} catch (Exception e) {e.printStackTrace();}
(in server.xml, in the Context /proxy of myVhost, I put crossContext="true")
If the Context /myNewContext is deployed in myVhost, the HTTPresponse is :
HTTP/1.1 200 OK
...
response of myNewServlet
If the Context /myNewContext is not deployed, the HTTPresponse is :
HTTP/1.1 404 /myNewServlet 
:-(

1) In other servlets containers, I read that ctx.getRequestDispatcher(...) 
returns null if the resource is absent.
So, Why Tomcat reacts differently ? Is it a bug ?
2) In my case, I'd want to forward to myNewServlet if it is present, BUT, if it is absent, I'd want to call another url distant (with httpclient)...
How can I do this with Tomcat ?
 
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RequestDispatcher.forward: a bug?

2005-03-02 Thread Lionel Farbos
Hi,
(I work on Tomcat 5.0.30).

When my servlet (http://myVhost/proxy/testProxy) forward to another servlet :
try {
  ServletContext ctx = getServletContext();
  ctx = ctx.getContext("/myNewContext");
  RequestDispatcher dispatcher = ctx.getRequestDispatcher("/myNewServlet");
  dispatcher.forward(request, response);
} catch (Exception e) {e.printStackTrace();}

(in server.xml, in the Context /proxy of myVhost, I put crossContext="true")

If the Context /myNewContext is deployed in myVhost, the HTTPresponse is :
HTTP/1.1 200 OK
...
response of myNewServlet

If the Context /myNewContext is not deployed, the HTTPresponse is :
HTTP/1.1 404 /myNewServlet 
:-(


1) In other servlets containers, I read that ctx.getRequestDispatcher(...) 
returns null if the resource is absent.
So, Why Tomcat reacts differently ? Is it a bug ?

2) In my case, I'd want to forward to myNewServlet if it is present, BUT, if it 
is absent, I'd want to call another url distant (with httpclient)...
How can I do this with Tomcat ?

Thanks in advance.

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



RE: RequestDispatcher.forward() forgets requestUri

2004-05-25 Thread Nitschke Michael
Im using the Invokerservlet.

mfg
Michael Nitschke

-Original Message-
From: Nitschke Michael 
Sent: Tuesday, May 25, 2004 3:54 PM
To: Tomcat Users List
Subject: RE: RequestDispatcher.forward() forgets requestUri

But in the API is written that this Abbributes are reset between requests. (Interface 
ServletRequest.setAttribute())
And if I use the names you provided below the values get overwritten with the values 
from the requestDispatcher.
Isn't it supposed that the RequestDispatcher forwards the Request as it was the 
initial request from the client?

mfg
Michael Nitschke

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 25, 2004 2:57 PM
To: Tomcat Users List
Subject: RE: RequestDispatcher.forward() forgets requestUri


Hi,
I strongly suggest (to anyone on the list not having done so) reading the Servlet 
Specification:

SRV.8.3.1 Included Request Parameters
Except for servlets obtained by using the getNamedDispatcher method, a servlet
that has been invoked by another servlet using the include method of
RequestDispatcher has access to the path by which it was invoked.
The following request attributes must be set:
javax.servlet.include.request_uri
javax.servlet.include.context_path
javax.servlet.include.servlet_path
javax.servlet.include.path_info
javax.servlet.include.query_string
These attributes are accessible from the included servlet via the getAttribute
method on the request object and their values must be equal to the request URI,
context path, servlet path, path info, and query string of the included servlet,
respectively. If the request is subsequently included, these attributes are replaced
for that include.
If the included servlet was obtained by using the getNamedDispatcher
method, these attributes must not be set.
SRV.8.4 The Forward Method
The forward method of the RequestDispatcher interface may be called by the
calling servlet only when no output has been committed to the client. If output data
exists in the response buffer that has not been committed, the content must be
cleared before the target servlet's service method is called. If the response has been
committed, an IllegalStateException must be thrown.


Yoav Shapira
Millennium Research Informatics


>-Original Message-
>From: Nitschke Michael [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, May 25, 2004 4:37 AM
>To: [EMAIL PROTECTED]
>Subject: RequestDispatcher.forward() forgets requestUri
>
>I use RequestDispatcher.forward(path) and the original requestUri get lost.
>
>If it is suppoused to do so, is there a way to get the original requestUri
>after the forward?
>
>
>
>
>
>Mit freundlichen Grüßen
>
>
>
>Michael Nitschke
>
>
>
>
>MBI Institut für Marketingberatung AG
>
>
>
>
>
>
>
>Hietzinger Hauptstraße 119-121
>A-1130  Wien
>tel +43 (1) 8777474 9710
>fax +43 (1) 8777474 9712
>e-mail [EMAIL PROTECTED]
>www.mbi.co.at
>
>
>
>
>
>
>
>Der Austausch von Nachrichten mit o.a. Absender via e-mail dient
>ausschliesslich Informationszwecken.
>Rechtsgeschaeftliche Erklaerungen duerfen ueber dieses Medium nicht
>ausgetauscht werden.
>
>
>
>
>Correspondence with a.m. sender via e-mail is only for information
>purposes.
>This medium is not to be used for the exchange of legally-binding
>communications.
>
>




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
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: RequestDispatcher.forward() forgets requestUri

2004-05-25 Thread Shapira, Yoav

Hi,

>Isn't it supposed that the RequestDispatcher forwards the Request as it
was
>the initial request from the client?

No: that's one key distinction between the RequestDispatcher and
HttpServletResponse#sendRedirect.

Yoav



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



RE: RequestDispatcher.forward() forgets requestUri

2004-05-25 Thread Nitschke Michael
But in the API is written that this Abbributes are reset between requests. (Interface 
ServletRequest.setAttribute())
And if I use the names you provided below the values get overwritten with the values 
from the requestDispatcher.
Isn't it supposed that the RequestDispatcher forwards the Request as it was the 
initial request from the client?

mfg
Michael Nitschke

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 25, 2004 2:57 PM
To: Tomcat Users List
Subject: RE: RequestDispatcher.forward() forgets requestUri


Hi,
I strongly suggest (to anyone on the list not having done so) reading the Servlet 
Specification:

SRV.8.3.1 Included Request Parameters
Except for servlets obtained by using the getNamedDispatcher method, a servlet
that has been invoked by another servlet using the include method of
RequestDispatcher has access to the path by which it was invoked.
The following request attributes must be set:
javax.servlet.include.request_uri
javax.servlet.include.context_path
javax.servlet.include.servlet_path
javax.servlet.include.path_info
javax.servlet.include.query_string
These attributes are accessible from the included servlet via the getAttribute
method on the request object and their values must be equal to the request URI,
context path, servlet path, path info, and query string of the included servlet,
respectively. If the request is subsequently included, these attributes are replaced
for that include.
If the included servlet was obtained by using the getNamedDispatcher
method, these attributes must not be set.
SRV.8.4 The Forward Method
The forward method of the RequestDispatcher interface may be called by the
calling servlet only when no output has been committed to the client. If output data
exists in the response buffer that has not been committed, the content must be
cleared before the target servlet's service method is called. If the response has been
committed, an IllegalStateException must be thrown.


Yoav Shapira
Millennium Research Informatics


>-Original Message-
>From: Nitschke Michael [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, May 25, 2004 4:37 AM
>To: [EMAIL PROTECTED]
>Subject: RequestDispatcher.forward() forgets requestUri
>
>I use RequestDispatcher.forward(path) and the original requestUri get lost.
>
>If it is suppoused to do so, is there a way to get the original requestUri
>after the forward?
>
>
>
>
>
>Mit freundlichen Grüßen
>
>
>
>Michael Nitschke
>
>
>
>
>MBI Institut für Marketingberatung AG
>
>
>
>
>
>
>
>Hietzinger Hauptstraße 119-121
>A-1130  Wien
>tel +43 (1) 8777474 9710
>fax +43 (1) 8777474 9712
>e-mail [EMAIL PROTECTED]
>www.mbi.co.at
>
>
>
>
>
>
>
>Der Austausch von Nachrichten mit o.a. Absender via e-mail dient
>ausschliesslich Informationszwecken.
>Rechtsgeschaeftliche Erklaerungen duerfen ueber dieses Medium nicht
>ausgetauscht werden.
>
>
>
>
>Correspondence with a.m. sender via e-mail is only for information
>purposes.
>This medium is not to be used for the exchange of legally-binding
>communications.
>
>




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
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: RequestDispatcher.forward() forgets requestUri

2004-05-25 Thread Shapira, Yoav

Hi,
I strongly suggest (to anyone on the list not having done so) reading the Servlet 
Specification:

SRV.8.3.1 Included Request Parameters
Except for servlets obtained by using the getNamedDispatcher method, a servlet
that has been invoked by another servlet using the include method of
RequestDispatcher has access to the path by which it was invoked.
The following request attributes must be set:
javax.servlet.include.request_uri
javax.servlet.include.context_path
javax.servlet.include.servlet_path
javax.servlet.include.path_info
javax.servlet.include.query_string
These attributes are accessible from the included servlet via the getAttribute
method on the request object and their values must be equal to the request URI,
context path, servlet path, path info, and query string of the included servlet,
respectively. If the request is subsequently included, these attributes are replaced
for that include.
If the included servlet was obtained by using the getNamedDispatcher
method, these attributes must not be set.
SRV.8.4 The Forward Method
The forward method of the RequestDispatcher interface may be called by the
calling servlet only when no output has been committed to the client. If output data
exists in the response buffer that has not been committed, the content must be
cleared before the target servlet's service method is called. If the response has been
committed, an IllegalStateException must be thrown.


Yoav Shapira
Millennium Research Informatics


>-Original Message-
>From: Nitschke Michael [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, May 25, 2004 4:37 AM
>To: [EMAIL PROTECTED]
>Subject: RequestDispatcher.forward() forgets requestUri
>
>I use RequestDispatcher.forward(path) and the original requestUri get lost.
>
>If it is suppoused to do so, is there a way to get the original requestUri
>after the forward?
>
>
>
>
>
>Mit freundlichen Grüßen
>
>
>
>Michael Nitschke
>
>
>
>
>MBI Institut für Marketingberatung AG
>
>
>
>
>
>
>
>Hietzinger Hauptstraße 119-121
>A-1130  Wien
>tel +43 (1) 8777474 9710
>fax +43 (1) 8777474 9712
>e-mail [EMAIL PROTECTED]
>www.mbi.co.at
>
>
>
>
>
>
>
>Der Austausch von Nachrichten mit o.a. Absender via e-mail dient
>ausschliesslich Informationszwecken.
>Rechtsgeschaeftliche Erklaerungen duerfen ueber dieses Medium nicht
>ausgetauscht werden.
>
>
>
>
>Correspondence with a.m. sender via e-mail is only for information
>purposes.
>This medium is not to be used for the exchange of legally-binding
>communications.
>
>




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



RequestDispatcher.forward() forgets requestUri

2004-05-25 Thread Nitschke Michael
I use RequestDispatcher.forward(path) and the original requestUri get lost.

If it is suppoused to do so, is there a way to get the original requestUri after the 
forward?

 

 

Mit freundlichen Grüßen

 

Michael Nitschke
 

 

MBI Institut für Marketingberatung AG

 

 

 

Hietzinger Hauptstraße 119-121
A-1130  Wien
tel +43 (1) 8777474 9710
fax +43 (1) 8777474 9712
e-mail [EMAIL PROTECTED] 
www.mbi.co.at 

 

 

 

Der Austausch von Nachrichten mit o.a. Absender via e-mail dient ausschliesslich 
Informationszwecken. 
Rechtsgeschaeftliche Erklaerungen duerfen ueber dieses Medium nicht ausgetauscht 
werden.
 

 

Correspondence with a.m. sender via e-mail is only for information purposes. 
This medium is not to be used for the exchange of legally-binding communications.

 



RE: RequestDispatcher.forward to cgi?

2003-12-05 Thread Januski, Ken
Thanks Tim,

I'll keep working on it then and see where it gets me.

Ken

-Original Message-
From: Tim Funk [mailto:[EMAIL PROTECTED]
Sent: Friday, December 05, 2003 12:54 PM
To: Tomcat Users List
Subject: Re: RequestDispatcher.forward to cgi?


I would think that the CGI servlet would work on a forward but you must be 
sure that:
1) No input streams were open (or that they are compatible with the
CGIServlet)
2) On a POST, you do not call or look at request parameters or the input 
stream since it looks like the CGIServlet wants to pass the Inputstream
right 
to the servlet.
3) I am unsure of how the CGI servlet goes to look for the exe with respect 
to a forward. (But I think you should be ok)

-Tim

Januski, Ken wrote:

> Tim,
> 
> Now that I look at them closely I see that most of them are due to a
looping
> problem in my program. So it just logs over and over that it's forwarding
> the request. I'll investigate to see if the loop is due to an error in my
> progamming (certainly possible since I've had to tinker with a very large
> controller servlet in order to incorporate this cgi page) or due to a
> failure in forwarding.
> 
> What I was hoping in asking the question though was to find out whether
> anyone had done this successfully or not. I'm happy to troubleshoot the
> problem if I think there's a chance of success. But I hate to spend the
time
> on it if I'm just trying to do the impossible or the dumb.
> 
> Ken
> 
> 
> -Original Message-
> From: Tim Funk [mailto:[EMAIL PROTECTED]
> Sent: Thursday, December 04, 2003 9:21 PM
> To: Tomcat Users List
> Subject: Re: RequestDispatcher.forward to cgi?
> 
> 
> Just curious ... what are the errors?
> 
> -Tim
> 
> Januski, Ken wrote:
> 
> 
>>I've finally managed to get cgi working in Tomcat. Now I need to forward
>>from a servlet to a cgi page. But both RequestDispatcher.forward and
>>RequestDispatcher.include are failing. I'm not surprised that include does
>>but I thought it might be possible with forward.
>>
>>Since this is part of a large application that keeps track of the session
>>I'd like to be able to include the cgi page in the application. But I'm
>>beginning to think that's not possible. So I wonder if anyone knows
> 
> whether
> 
>>it's possible to forward to a cgi page within the same Tomcat webapp. If
> 
> not
> 
>>I'll save myself a lot of trouble and just make it a separate webapp with
>>just a cgi component.
>>
>>Thanks for any advice.
>>
>>Ken
>>
>>P.S. I'm using cgi with perl because I can't find a class to add IPTC
>>information to a Jpg and I don't have time to write it myself. Such a
> 
> module
> 
>>does already exist in Perl.
>>
>>
>>
> 
> 
> 
> -
> 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: RequestDispatcher.forward to cgi?

2003-12-05 Thread Tim Funk
I would think that the CGI servlet would work on a forward but you must be 
sure that:
1) No input streams were open (or that they are compatible with the CGIServlet)
2) On a POST, you do not call or look at request parameters or the input 
stream since it looks like the CGIServlet wants to pass the Inputstream right 
to the servlet.
3) I am unsure of how the CGI servlet goes to look for the exe with respect 
to a forward. (But I think you should be ok)

-Tim

Januski, Ken wrote:

Tim,

Now that I look at them closely I see that most of them are due to a looping
problem in my program. So it just logs over and over that it's forwarding
the request. I'll investigate to see if the loop is due to an error in my
progamming (certainly possible since I've had to tinker with a very large
controller servlet in order to incorporate this cgi page) or due to a
failure in forwarding.
What I was hoping in asking the question though was to find out whether
anyone had done this successfully or not. I'm happy to troubleshoot the
problem if I think there's a chance of success. But I hate to spend the time
on it if I'm just trying to do the impossible or the dumb.
Ken

-Original Message-
From: Tim Funk [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 04, 2003 9:21 PM
To: Tomcat Users List
Subject: Re: RequestDispatcher.forward to cgi?
Just curious ... what are the errors?

-Tim

Januski, Ken wrote:


I've finally managed to get cgi working in Tomcat. Now I need to forward
from a servlet to a cgi page. But both RequestDispatcher.forward and
RequestDispatcher.include are failing. I'm not surprised that include does
but I thought it might be possible with forward.
Since this is part of a large application that keeps track of the session
I'd like to be able to include the cgi page in the application. But I'm
beginning to think that's not possible. So I wonder if anyone knows
whether

it's possible to forward to a cgi page within the same Tomcat webapp. If
not

I'll save myself a lot of trouble and just make it a separate webapp with
just a cgi component.
Thanks for any advice.

Ken

P.S. I'm using cgi with perl because I can't find a class to add IPTC
information to a Jpg and I don't have time to write it myself. Such a
module

does already exist in Perl.





-
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: RequestDispatcher.forward to cgi?

2003-12-05 Thread Januski, Ken
Tim,

Now that I look at them closely I see that most of them are due to a looping
problem in my program. So it just logs over and over that it's forwarding
the request. I'll investigate to see if the loop is due to an error in my
progamming (certainly possible since I've had to tinker with a very large
controller servlet in order to incorporate this cgi page) or due to a
failure in forwarding.

What I was hoping in asking the question though was to find out whether
anyone had done this successfully or not. I'm happy to troubleshoot the
problem if I think there's a chance of success. But I hate to spend the time
on it if I'm just trying to do the impossible or the dumb.

Ken


-Original Message-
From: Tim Funk [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 04, 2003 9:21 PM
To: Tomcat Users List
Subject: Re: RequestDispatcher.forward to cgi?


Just curious ... what are the errors?

-Tim

Januski, Ken wrote:

> I've finally managed to get cgi working in Tomcat. Now I need to forward
> from a servlet to a cgi page. But both RequestDispatcher.forward and
> RequestDispatcher.include are failing. I'm not surprised that include does
> but I thought it might be possible with forward.
> 
> Since this is part of a large application that keeps track of the session
> I'd like to be able to include the cgi page in the application. But I'm
> beginning to think that's not possible. So I wonder if anyone knows
whether
> it's possible to forward to a cgi page within the same Tomcat webapp. If
not
> I'll save myself a lot of trouble and just make it a separate webapp with
> just a cgi component.
> 
> Thanks for any advice.
> 
> Ken
> 
> P.S. I'm using cgi with perl because I can't find a class to add IPTC
> information to a Jpg and I don't have time to write it myself. Such a
module
> does already exist in Perl.
> 
> 
> 


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


Re: RequestDispatcher.forward to cgi?

2003-12-04 Thread Tim Funk
Just curious ... what are the errors?

-Tim

Januski, Ken wrote:

I've finally managed to get cgi working in Tomcat. Now I need to forward
from a servlet to a cgi page. But both RequestDispatcher.forward and
RequestDispatcher.include are failing. I'm not surprised that include does
but I thought it might be possible with forward.
Since this is part of a large application that keeps track of the session
I'd like to be able to include the cgi page in the application. But I'm
beginning to think that's not possible. So I wonder if anyone knows whether
it's possible to forward to a cgi page within the same Tomcat webapp. If not
I'll save myself a lot of trouble and just make it a separate webapp with
just a cgi component.
Thanks for any advice.

Ken

P.S. I'm using cgi with perl because I can't find a class to add IPTC
information to a Jpg and I don't have time to write it myself. Such a module
does already exist in Perl.




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


RequestDispatcher.forward to cgi?

2003-12-04 Thread Januski, Ken
I've finally managed to get cgi working in Tomcat. Now I need to forward
from a servlet to a cgi page. But both RequestDispatcher.forward and
RequestDispatcher.include are failing. I'm not surprised that include does
but I thought it might be possible with forward.

Since this is part of a large application that keeps track of the session
I'd like to be able to include the cgi page in the application. But I'm
beginning to think that's not possible. So I wonder if anyone knows whether
it's possible to forward to a cgi page within the same Tomcat webapp. If not
I'll save myself a lot of trouble and just make it a separate webapp with
just a cgi component.

Thanks for any advice.

Ken

P.S. I'm using cgi with perl because I can't find a class to add IPTC
information to a Jpg and I don't have time to write it myself. Such a module
does already exist in Perl.




Re: please explain behavior of Requestdispatcher.forward()

2003-11-15 Thread Christopher Schultz
Antony,
I have problem in using RequestDispatcher.forward() from servlets. My
knowledge is that even after calling this method servlet continues
processing the request and thus executes rest of the service method.
Your understanding is correct -- it's just a method call that returns.

But I
have seen that if a servlet is forwarding to same servlet it stops
responding unable to get a database connection from pool. (I have set
maxconncections to 1).
That's probably because your servlet looks like this:

try
{
conn = getConnection();
	// process

getRequestDispatcher().forward(...);
}
finally
{
conn.close();
}
This is a recipe for trouble, because you're still holding the 
connection when you forward to another servlet. If that servlet tries to 
get a connection, you have the potential for deadlock.

Good for you for setting your connection pool size to 1! Everyone should 
do this, because then you have the good fortune to find things like this 
in development environments instead of in production, and you try to 
figure out why all 25 of your connections seem to be tied up :)

Database connection is closed in service method in
the finally block which is coming after the forward() statement. What is
wrong ?.
You said it yourself: you are retaining the connection during the method 
call. Finally blocks run after all the code inside it done, not when the 
thread leaves the method. MEthod calls within try/finally blocks don't 
trigger the finally block to be called. You need to modify your code thus:

try
{
conn = getConnection();
// process
}
finally
{
conn.close();
}
if (iShouldForward)
getRequestDispatcher().forward(...);
else
getRequestDispatcher().redirect(...);
Another question how to remove a query string from a request before
forwarding it. (Actually I have to remove a textbox element from a form.)
I'm not sure you can do this... but, you can wrap the HttpServletRequest 
in an implementation that *you* write that can ignore that attribute. 
Seems pretty hacky. Another thing you could do is put a marker object in 
the request attributes that says "ignore the request parameter". Your 
other action, that should not see the element value, can check for that 
marker object and then ignore the parameter value.

-chris

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


Re: please explain behavior of Requestdispatcher.forward()

2003-11-15 Thread Antony Paul
Actually I have to remove a textbox element from a form.

Antony Paul
- Original Message -
From: "Antony Paul" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Saturday, November 15, 2003 5:33 PM
Subject: please explain behavior of Requestdispatcher.forward()


> Hi all,
> I have problem in using RequestDispatcher.forward() from servlets. My
> knowledge is that even after calling this method servlet continues
> processing the request and thus executes rest of the service method. But I
> have seen that if a servlet is forwarding to same servlet it stops
> responding unable to get a database connection from pool. (I have set
> maxconncections to 1).  Database connection is closed in service method in
> the finally block which is coming after the forward() statement. What is
> wrong ?. I am using Tomcat 4.1.27 and JDK 1.3.1.
> Another question how to remove a query string from a request before
> forwarding it.
>
> Antony 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]



please explain behavior of Requestdispatcher.forward()

2003-11-15 Thread Antony Paul
Hi all,
I have problem in using RequestDispatcher.forward() from servlets. My
knowledge is that even after calling this method servlet continues
processing the request and thus executes rest of the service method. But I
have seen that if a servlet is forwarding to same servlet it stops
responding unable to get a database connection from pool. (I have set
maxconncections to 1).  Database connection is closed in service method in
the finally block which is coming after the forward() statement. What is
wrong ?. I am using Tomcat 4.1.27 and JDK 1.3.1.
Another question how to remove a query string from a request before
forwarding it.

Antony Paul

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



Re: Filter and RequestDispatcher.forward()

2003-01-30 Thread Tomasz Stanczak
I have noticed that, too, while preparing a WebLogic web application to
run on Tomcat. 

The code of ApplicationDispatcher says:

"IMPLEMENTATION NOTE: This implementation assumes that
no filters are applied to a forwarded or included resource, because
they were already done for the original request."

For authorization that might even be better, check it once as it comes
from outside and if you pass you can go everywhere the current security
police allows.

I can imagine cases where it wouldn't work though - think about
pre-/post-processing each request for whatever reason (your own
proprietary security? to decorate each request? decompress in case not
all resource has been compressed and you have to decide request by
request?), regardless if included or forwarded.

In my case I was able to change my code but it was not trivial :-(

I think it should be at least controlled by parameters, nothing in the
Servlet API v.2 spec leads to believe that it should work that way.

Tomasz

 --- Tim Funk <[EMAIL PROTECTED]> schrieb: > Filters are only run once
for the incoming request. See the archives
> for 
> more information.
> 
> -Tim
> 
> Karl Kraft wrote:
> > I've written a Filter to get applied to all page requests so that I
> can 
> > perform some access control and logging.
> > 
> > However, when a servlet redirects using the forward() method of 
> > RequestDispatcher, it doesn't seem to go through the filter.
> > 
> > If needed, I can call the Filter manually before I do the
> forward(), but 
> > I'm wondering if there is a more preferred way to do this.
> > 
> > 
> >  
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  

__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Bis zu 100 MB Speicher bei http://premiummail.yahoo.de

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




Re: Filter and RequestDispatcher.forward()

2003-01-29 Thread Tim Funk
Filters are only run once for the incoming request. See the archives for 
more information.

-Tim

Karl Kraft wrote:
I've written a Filter to get applied to all page requests so that I can 
perform some access control and logging.

However, when a servlet redirects using the forward() method of 
RequestDispatcher, it doesn't seem to go through the filter.

If needed, I can call the Filter manually before I do the forward(), but 
I'm wondering if there is a more preferred way to do this.


 


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




Filter and RequestDispatcher.forward()

2003-01-29 Thread Karl Kraft
I've written a Filter to get applied to all page requests so that I can 
perform some access control and logging.

However, when a servlet redirects using the forward() method of 
RequestDispatcher, it doesn't seem to go through the filter.

If needed, I can call the Filter manually before I do the forward(), 
but I'm wondering if there is a more preferred way to do this.



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



Newbie question - NullPointerException when doing RequestDispatcher.forward(..)

2002-07-18 Thread Maya Vayner

Hi,
I have the NullPointerException thrown by forward method of RequestDispatcher object. 

Code line that does that:
   
 // value of page parameter is "/view/errors/paramErrors.jsp"
 getServletContext().getRequestDispatcher(page).forward(request, response);  

Basically, it is inside of a method that has to forward HttpServletRequest and 
HttpServletResponse to some jsp page. The Excpetion is thrown when executing forward 
method.
Please, let me know what you think can fix this.
Thank you.
Maya Vayner




_
Supercharge your e-mail with a 25MB Inbox, POP3 Access, No Ads
and NoTaglines --> LYCOS MAIL PLUS.
http://www.mail.lycos.com/brandPage.shtml?pageId=plus 

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RequestDispatcher.forward to CGI

2002-06-30 Thread C F

Hello,

I've been trying to use the following procedure to forward a request from my 
servlet to a CGI program within the same application space
getServletContext().getRequestDispatcher("/cgi-bin/my_cgi_prog").forward(request,response);

... which results in the following error
"Servlet invoker is currently unavailable"

Looking at Sun's servlet tutorial, they indicate that this would be 
possible.
http://java.sun.com/docs/books/tutorial/servlets/communication/request-dispatcher.html

However, I did notice that Tomcat's documentation makes no mention of being 
able to forward requests in this manner to CGI... only other JSPs and 
servlets.  All I want is to pass the HTTP request to my CGI program via a 
servlet, the CGI program will respond with HTML and pass it back to the 
client browser via the servlet.  So I have a few questions...

1)  Has anybody been successful doing this? How?

2)  If it's not possible in the current Tomcat, is it something that might 
be available soon (I noticed that this release is Tomcat's first shot at CGI 
availability)?

2)  If it is not possible to do this in Tomcat, can anybody think of another 
solution?  Response.sendRedirect is NOT an option.  The reason I'm 
attempting this is because I want to control access and input to my CGI 
program through a servlet.  I don't want the browser calling it directly.  
I'm thinking maybe the URLConnection class might be of use, but then I still 
have the issue of controlling access to it and maybe another performance 
hit.  Or maybe I'm wrong.  Ideas?

Environment:
Tomcat 4.0.4 (standalone)
JDK 1.4
Redhat Linux 7.3

Thanks!

_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Fwd: Unable to use RequestDispatcher.forward() for HTML pages when in Tomcat 4

2002-02-26 Thread Sriram Narayanan

Hello all,

I'd posted to this list a few days ago asking for help on this problem.

On the computer where I run tomcat and faced the RequestDispatcher problem, I've 
started to get JIT errors instead. I've also been getting a 
lot of "Illegal Operation" messages by Windows on the same computer for the past few 
days.

I got a chance to check this problem again today on another computer, and everything 
ran just fine.

So I guess I have to either reinstall Windows NT, and maybe even get the RAM on my 
computer checked.

Thanks everybody for helping me out.

By the way, I tried the following, and both worked:

getServletContext().getRequestDispatcher("/index.html").include(request,response);

and separately,

getServletContext().getRequestDispatcher("/index.html").forward(request,response);


Thanks again.

Sriram

--- Start of forwarded message ---
From: Sriram Narayanan <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Subject: Unable to use RequestDispatcher.forward() for HTML pages when in Tomcat 4
Date: 2/21/02 8:06:31 PM

Hello all,

I am able to use the RequestDispatcher forward control from one JSP page to another. 
However I am unable to forward to HTML pages.
>From what I read in the Servlet API spec (there's an example for /garden/ etc) and 
>the docs for RequestDispatcher(), one should indeed be 
able to forward to HTML pages

Here's what I have in my JSP:

<%getServletContext().getRequestDispatcher("/html/authhome.html").forward(request,response);%>

And here's what I found in the generated JSP page:

--- beginepartial quote -
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();

// begin [file="/notauthorized.jsp";from=(0,2);to=(0,92)]

getServletContext().getRequestDispatcher("/html/authhome.html").forward(request,response);
// end
// HTML // begin [file="/notauthorized.jsp";from=(0,94);to=(1,0)]
out.write("\r\n");

// end

- end partial quote 

Could someone please point me to what it is that I'm doing wrong ?

I have only the Servlet API spec with me, and not the JSP spec, which I have not been 
able to download yet (Internet connection problems)

Thanks,

Sriram

 End of forwarded message 




_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




Re: Unable to use RequestDispatcher.forward() for HTML pages when in Tomcat 4

2002-02-22 Thread Dmitry Nikelshpur

Hi Sriram,

Try changing the .html extension to .jsp extensionThis should work 
if your JSP pages work :-)

Dmitry

Sriram Narayanan wrote:

>Hello all,
>
>I am able to use the RequestDispatcher forward control from one JSP page to another. 
>However I am unable to forward to HTML pages.
>>From what I read in the Servlet API spec (there's an example for /garden/ etc) and 
>the docs for RequestDispatcher(), one should indeed be 
>able to forward to HTML pages
>
>Here's what I have in my JSP:
>
><%getServletContext().getRequestDispatcher("/html/authhome.html").forward(request,response);%>
>
>And here's what I found in the generated JSP page:
>
>--- beginepartial quote -
>application = pageContext.getServletContext();
>config = pageContext.getServletConfig();
>session = pageContext.getSession();
>out = pageContext.getOut();
>
>// begin [file="/notauthorized.jsp";from=(0,2);to=(0,92)]
>
>getServletContext().getRequestDispatcher("/html/authhome.html").forward(request,response);
>// end
>// HTML // begin [file="/notauthorized.jsp";from=(0,94);to=(1,0)]
>out.write("\r\n");
>
>// end
>
>- end partial quote 
>
>Could someone please point me to what it is that I'm doing wrong ?
>
>I have only the Servlet API spec with me, and not the JSP spec, which I have not been 
>able to download yet (Internet connection problems)
>
>Thanks,
>
>Sriram
>
>
>
>_
>Do You Yahoo!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>--
>To unsubscribe:   
>For additional commands: 
>Troubles with the list: 
>
>
>



--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Unable to use RequestDispatcher.forward() for HTML pages when in Tomcat 4

2002-02-21 Thread Greg Trasuk

Hi:

From Page 56 of the Servlet 2.3 spec:

The getRequestDispatcher method takes a String argument describing a
path within the scope of the ServletContext. This path must be relative to
the root
of the ServletContext and begin with a '/' The method uses the path to look
up a
servlet, wraps it with a RequestDispatcher object, and returns the resulting
object.
If no servlet can be resolved based on the given path, a
RequestDispatcher
is provided that returns the content for that path.



That certainly seems to indicate that what you're trying should work.
Here's a couple ideas:
1- Are you sure the path is right, considering your webapp context name?
If your webapp context was "/app", then the requestdispatcher for
"/html/authhome.html" would actually resolve to
"http://yourhost.com/app/html/authhome.html";.  Is that what you're
expecting?

2- Could you try renaming your html file to "authhome.jsp"?  Or is there a
specific reason that it needs to remain ".html".  A JSP file that contains
no scripting elements will behave exactly like an html file.  One possible
downside is that the file needs to be translated and compiled, which will
cause a slight delay to the first user that hits it, but I would think an
authorization page would be accessed pretty frequently, so it wouldn't be an
issue.

3- Perhaps the response.sendRedirect(String URL) functionality would be
appropriate in your situation.  That would sidestep the whole issue by
simply letting the browser handle it.

Good luck.

Greg Trasuk, President
StratusCom Manufacturing Systems Inc. - We use information technology to
solve business problems on your plant floor.
http://stratuscom.ca

> -Original Message-
> From: Sriram Narayanan [mailto:[EMAIL PROTECTED]]
> Sent: February 21, 2002 09:37
> To: Tomcat Users List
> Subject: Unable to use RequestDispatcher.forward() for HTML pages when
> in Tomcat 4
>
>
> Hello all,
>
> I am able to use the RequestDispatcher forward control from
> one JSP page to another. However I am unable to forward to HTML pages.
> From what I read in the Servlet API spec (there's an example
> for /garden/ etc) and the docs for RequestDispatcher(), one
> should indeed be
> able to forward to HTML pages
>
> Here's what I have in my JSP:
>
> <%getServletContext().getRequestDispatcher("/html/authhome.htm
> l").forward(request,response);%>
>
> And here's what I found in the generated JSP page:
>
> --- beginepartial quote -
> application = pageContext.getServletContext();
> config = pageContext.getServletConfig();
> session = pageContext.getSession();
> out = pageContext.getOut();
>
> // begin [file="/notauthorized.jsp";from=(0,2);to=(0,92)]
>
> getServletContext().getRequestDispatcher("/html/authhome.html"
> ).forward(request,response);
> // end
> // HTML // begin
> [file="/notauthorized.jsp";from=(0,94);to=(1,0)]
> out.write("\r\n");
>
> // end
>
> - end partial quote 
>
> Could someone please point me to what it is that I'm doing wrong ?
>
> I have only the Servlet API spec with me, and not the JSP
> spec, which I have not been able to download yet (Internet
> connection problems)
>
> Thanks,
>
> Sriram
>
>
>
> _
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




Unable to use RequestDispatcher.forward() for HTML pages when in Tomcat 4

2002-02-21 Thread Sriram Narayanan

Hello all,

I am able to use the RequestDispatcher forward control from one JSP page to another. 
However I am unable to forward to HTML pages.
>From what I read in the Servlet API spec (there's an example for /garden/ etc) and 
>the docs for RequestDispatcher(), one should indeed be 
able to forward to HTML pages

Here's what I have in my JSP:

<%getServletContext().getRequestDispatcher("/html/authhome.html").forward(request,response);%>

And here's what I found in the generated JSP page:

--- beginepartial quote -
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();

// begin [file="/notauthorized.jsp";from=(0,2);to=(0,92)]

getServletContext().getRequestDispatcher("/html/authhome.html").forward(request,response);
// end
// HTML // begin [file="/notauthorized.jsp";from=(0,94);to=(1,0)]
out.write("\r\n");

// end

- end partial quote 

Could someone please point me to what it is that I'm doing wrong ?

I have only the Servlet API spec with me, and not the JSP spec, which I have not been 
able to download yet (Internet connection problems)

Thanks,

Sriram



_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: RequestDispatcher.forward() ?

2001-11-12 Thread Dr. Evil


> Could somebody tell me if this behavior by design and if so why:
> 
> The following fragment forwards a request to main application page:
> 
> //---
> String main = "/index.jsp";
> //String main = "/";
> 
> RequestDispatcher dispatcher
> = getServletContext().getRequestDispatcher(main);
> dispatcher.forward(req, resp);
> //---
> 
> 
> Forwarding works on server side if code being executed as shown (main is
> "/index.jsp") so client isn't aware about it. However, if main is set to be
> "/" (commented line above), 302 is sent to the client, so it's not a
> server-side redirect, right? In this case response "Location" header is set
> to http://host/pathtowebapp/index.jsp. Am I missing something? Tomcat was
> able to find out that index.jsp is a welcome file but nonetheless it's a
> client side redirect. Not a big problem of course, just curious...

You have to be clear about what you mean when you say "forward".
There is "send a redirect" or "get a RequestDispatcher", which are
different things.  What the fragment above does is it tries to forward
to a servlet which is the resources associated with /.  That doesn't
exist so it sends an error.  If you want to send something to the
client you need to use response.sendRedirect() I believe.

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: RequestDispatcher.forward() and filters

2001-11-12 Thread Jim Cheesman

At 06:46 AM 12/11/01, you wrote:


>On Sat, 10 Nov 2001, Matt Egyhazy wrote:
>
> > i have seen very, very, very bad code written
> > for applications that use jsp.
> >
>
>You should see some of the horrible servlet-based code I've also had to
>look at.  People that are bound and determined to shoot themselves in the
>foot no matter what tools you give them. :-)


Sheesh! You guys are  NO FUN! Am I the only person around here that likes 
perl and regex for just that reason??? Where's the fun in programming if 
you can't hack every now and then?



(And screw the maintenance guys!)





--

   *   Jim Cheesman   *
 Trabajo: 
[EMAIL PROTECTED] - (34)(91) 724 9200 x 2360
   Cooperation can only be 
reached if we work together.



--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: RequestDispatcher.forward() ?

2001-11-11 Thread Craig R. McClanahan



On Sun, 11 Nov 2001, Vladimir Grishchenko wrote:

> Date: Sun, 11 Nov 2001 18:30:37 -0800
> From: Vladimir Grishchenko <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: RequestDispatcher.forward() ?
>
> Hi there,
>
> Could somebody tell me if this behavior by design and if so why:
>
> The following fragment forwards a request to main application page:
>
> //---
> String main = "/index.jsp";
> //String main = "/";
>
> RequestDispatcher dispatcher
> = getServletContext().getRequestDispatcher(main);
> dispatcher.forward(req, resp);
> //---
>
>
> Forwarding works on server side if code being executed as shown (main is
> "/index.jsp") so client isn't aware about it. However, if main is set to be
> "/" (commented line above), 302 is sent to the client, so it's not a
> server-side redirect, right? In this case response "Location" header is set
> to http://host/pathtowebapp/index.jsp. Am I missing something? Tomcat was
> able to find out that index.jsp is a welcome file but nonetheless it's a
> client side redirect. Not a big problem of course, just curious...
>

The reason has to do with how Tomcat happens to implement things.  Let's
walk through what is really happening to make sense of it:

* You ask for a dispatcher for path "/".

* Tomcat resolves this to the default file-serving servlet
  (unless you have done something really strange to your configuration).

* The default file-serving servlet treats a path of "/" as a
  request for the appropriate welcome file for this web application,
  so it looks up the right path and issues an HTTP redirect (302).

Try a request dispatcher for "/index.html" (or "/index.jsp", or whatever
is appropriate for your application), and you will find that it's all done
on the server side.  The "/" path will explicitly ask for a redirect,
which is why you are seeing one.

> regards,
> Vlad.
>

Craig McClanahan


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RequestDispatcher.forward

2001-11-02 Thread Brian Kreitzer

For the life of me I can't get this to work or the
.include function.  Here is my code:

public class HelloWorldExample extends HttpServlet {


public void doGet(HttpServletRequest request,
  HttpServletResponse response)
throws IOException, ServletException
{
ResourceBundle rb =
   
ResourceBundle.getBundle("LocalStrings",request.getLocale());
response.setContentType("text/html");
PrintWriter out = response.getWriter();

String address = "/questo/" +
Style.servPath + "Test";
getServletContext().log("address :" + address);
getServletContext().log("before dispatcher");
RequestDispatcher dispatcher =
getServletContext().getRe
questDispatcher(address);
getServletContext().log("before forward");
dispatcher.include(request,
response);
getServletContext().log("After forward");
return;
}
}


If I type in http://localhost/questo/servlet/Test into
my browser, the servlet page loads.  It is a very
simple servlet almost exactly like the
HelloWorldExample servlet except I changed the title
to say Just Testing! instead of Hello World!
All I get is a blank screen in my browser and the
following in the localhost_log.2001-11.02.txt log
file:

2001-11-02 22:15:50
InvokerFilter(ApplicationFilterConfig[name=Path Mapped
Filte
r, filterClass=filters.ExampleFilter]): 20
milliseconds
2001-11-02 22:25:51 address :/questo/servlet/Test
2001-11-02 22:25:51 before dispatcher
2001-11-02 22:25:51 before forward
2001-11-02 22:25:51 After forward
2001-11-02 22:25:51
InvokerFilter(ApplicationFilterConfig[name=Path Mapped
Filte
r, filterClass=filters.ExampleFilter]): 10
milliseconds

There are no errors that I see.  Can someone help me
with this?  I tried Tomcat 3.2.3 then installed 4.0
and I get the same behavior in both.

Thanks,


=
Brian Kreitzer

Owner
Kreitzer Kreations

__
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: RequestDispatcher.forward()?

2001-08-26 Thread Jann VanOver

Or, more specifically:
  http://java.sun.com/j2ee/tutorial/api/index.html

You'll find RequestDispatcher in the "All Classes" frame.

-Original Message-
From: Rob S. [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 24, 2001 7:55 AM
To: [EMAIL PROTECTED]
Subject: Re: RequestDispatcher.forward()?


> Can you please explain to me how to use RequestDispatcher.forward()?

Yikes...  you're better off searching Google or picking up a book on
servlets.  Or heck, you could read the servlet api javadoc comments =)

- r



Re: RequestDispatcher.forward()?

2001-08-24 Thread Rob S.

> Can you please explain to me how to use RequestDispatcher.forward()?

Yikes...  you're better off searching Google or picking up a book on servlets.  Or 
heck, you could read the servlet api javadoc comments =)

- r




RequestDispatcher.forward()?

2001-08-24 Thread yuval

Can you please explain to me how to use RequestDispatcher.forward()?

Regards,

Yuval
Domain The Net Technologies Ltd.
6 Weitzman Blvd.
Ramat-Hasharon
Israel 47211
Tel: 972-3-5474443
Fax: 972-3-5474446
www.DomainTheNet.com

“This email message and any attachments hereto are intended only for use by
the addressee(s) named above, and may contain legally privileged and/or
confidential information. If you are not the intended addressee, you are
hereby kindly notified that any dissemination, distribution or copying of
this email and any attachments hereto is strictly prohibited. If you have
received this email in error, kindly delete it from your computer system,
and notify us at the telephone number or email address appearing above.
Thank you"





RE: Using RequestDispatcher.forward() and changing browser URL

2001-06-12 Thread Filip Hanik

you could do a RequestDispatcher.sendRedirect instead

Filip

~
Namaste - I bow to the divine in you
~
Filip Hanik
Software Architect
[EMAIL PROTECTED]
www.filip.net 

>-Original Message-
>From: Kevin Regan [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, June 12, 2001 4:28 PM
>To: [EMAIL PROTECTED]
>Subject: Using RequestDispatcher.forward() and changing browser URL
>
>
>
>I'm using RequestDispatcher.forward() in one servlet to forward a 
>request to 
>another servlet (or JSP page).  I would like the URL for the forwarded 
>servlet or JSP page to show up in the client's browser rather than the 
>original request URL.  Is this possible and how can it be accomplished?  
>I've tried "Location" and "Content-Location" without any luck...
>
>Sincerely,
>Kevin Regan
>[EMAIL PROTECTED]
>
>_
>Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>



Using RequestDispatcher.forward() and changing browser URL

2001-06-12 Thread Kevin Regan


I'm using RequestDispatcher.forward() in one servlet to forward a request to 
another servlet (or JSP page).  I would like the URL for the forwarded 
servlet or JSP page to show up in the client's browser rather than the 
original request URL.  Is this possible and how can it be accomplished?  
I've tried "Location" and "Content-Location" without any luck...

Sincerely,
Kevin Regan
[EMAIL PROTECTED]

_
Get your FREE download of MSN Explorer at http://explorer.msn.com




RE: response.sendRedirect vs. requestDispatcher.forward

2001-05-31 Thread Martin van den Bemt

Hi,

Never used the reqeuestdispatcher, but in your case it could be something
like :

response.sendRedirect("http:login.jsp");

(don't know where tomcat is serving jsp files though, I never use them..)

Mvgr,
Martin

> -Original Message-
> From: Brandon Cruz [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 31, 2001 3:26 PM
> To: [EMAIL PROTECTED]
> Subject: RE: response.sendRedirect vs. requestDispatcher.forward
>
>
> So what is the correct way to redirect?  I have started using
> relative links
> to redirect and it seems to fix the problem.  Is this just coincidence, or
> is there an explanation for that?
>
> Brandon
>
> -Original Message-
> From: Martin van den Bemt [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 30, 2001 6:38 PM
> To: [EMAIL PROTECTED]
> Subject: RE: response.sendRedirect vs. requestDispatcher.forward
>
>
> If you webserver is serving in /usr/local/apache/htdocs, you are
> redirecting
> to /usr/local/apache/htdocs/login.jsp, which is handled in this example by
> apache, who doesn't know anything about jsp files. (that's why you got
> tomcat in the first place...)
>
> Mvgr,
> Martin
>
> > -Original Message-
> > From: Brandon Cruz [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 31, 2001 1:31 AM
> > To: [EMAIL PROTECTED]
> > Subject: RE: response.sendRedirect vs. requestDispatcher.forward
> >
> >
> > Has anyone figured out why response.sendRedirect("/login.jsp")
> > will not work
> > when using apache-tomcat with mod_jk?  It gets all screwed up
> and prints a
> > bunch of header information out to the page...is there a way around it
> > besides using javascript to redirect the page?
> >
> > Brandon Cruz
> >
> > -Original Message-
> > From: A Yang [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, May 30, 2001 1:13 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: response.sendRedirect vs. requestDispatcher.forward
> >
> >
> > Hi,
> >
> > Thanks for the help. As it turns out, switching
> > between requestDispath.forward and response.redirect
> > will trip you up because of differences in what they
> > expect as their parameters.
> >
> > RequestDispatch.forward takes a URL that is a RELATIVE
> > path but also requires a leading slash.
> >
> > If you are brilliant (like myself) and you change your
> > code to use response.encodeRedirectURL but you KEEP
> > that leading slash, well then. Your response will
> > treat it like an absolute path and wind up plunking
> > you into a different servlet context, which Tomcat
> > will generate a new session for.
> >
> > Thanks again for your help,
> > Andy
> >
> > --- Martin van den Bemt <[EMAIL PROTECTED]> wrote:
> > > A different hostname creates a new session which
> > > could be the problem here..
> > > (so http://www.example.com and http://example.com
> > > create a different session even it's the same
> > > server/context/etc..
> > >
> > > Mvgr,
> > > Martin
> > >
> > > > -Original Message-
> > > > From: Alex Fernandez [mailto:[EMAIL PROTECTED]]
> > > > Sent: Tuesday, May 29, 2001 4:57 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: response.sendRedirect vs.
> > > requestDispatcher.forward
> > > >
> > > >
> > > > Conceptually, requestDispatcher.forward() is
> > > different from
> > > > response.sendRedirect().
> > > >
> > > > In forward(), you are moving inside the same
> > > webapp, and as such it
> > > > doesn't even reach the client browser. The session
> > > is maintained.
> > > >
> > > > In sendRedirect(), you're instead moving across
> > > webapps, and it's the
> > > > browser that redirects to the specified location.
> > > In fact, it doesn't
> > > > even need to be another servlet, you may redirect
> > > to an ASP or a static
> > > > page. New request and response are created.
> > > >
> > > > It seems strange that the session is not
> > > maintained, though, since both
> > > > requests come from the same browser. Perhaps it's
> > > a bug?
> > > >
> > > > Un saludo,
> > > >
> > > > Alex.
> > > >
> > > > A Yang wrote:
> > > > >
> > > > > Hi All,
> > > > >
> >

Re: response.sendRedirect vs. requestDispatcher.forward

2001-05-31 Thread Alex Fernández

Hi Andy!

Just a fine point here.

A Yang wrote:
> RequestDispatch.forward takes a URL that is a RELATIVE
> path but also requires a leading slash.

>From the javadoc of ServletRequest.getRequestDispatcher(String):

'The pathname specified may be relative, although it cannot extend
outside the current servlet context. If the path begins with a "/" it is
interpreted as relative to the current context root. This method returns
null if the servlet container cannot return a RequestDispatcher.

The difference between this method and
ServletContext.getRequestDispatcher(String) is that this method can take
a relative path.'

So, if you get your RequestDispatcher from the request, you don't need
the leading "/".

Un saludo,

Alex.



RE: response.sendRedirect vs. requestDispatcher.forward

2001-05-31 Thread Brandon Cruz

So what is the correct way to redirect?  I have started using relative links
to redirect and it seems to fix the problem.  Is this just coincidence, or
is there an explanation for that?

Brandon

-Original Message-
From: Martin van den Bemt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 6:38 PM
To: [EMAIL PROTECTED]
Subject: RE: response.sendRedirect vs. requestDispatcher.forward


If you webserver is serving in /usr/local/apache/htdocs, you are redirecting
to /usr/local/apache/htdocs/login.jsp, which is handled in this example by
apache, who doesn't know anything about jsp files. (that's why you got
tomcat in the first place...)

Mvgr,
Martin

> -Original Message-
> From: Brandon Cruz [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 31, 2001 1:31 AM
> To: [EMAIL PROTECTED]
> Subject: RE: response.sendRedirect vs. requestDispatcher.forward
>
>
> Has anyone figured out why response.sendRedirect("/login.jsp")
> will not work
> when using apache-tomcat with mod_jk?  It gets all screwed up and prints a
> bunch of header information out to the page...is there a way around it
> besides using javascript to redirect the page?
>
> Brandon Cruz
>
> -Original Message-
> From: A Yang [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 30, 2001 1:13 PM
> To: [EMAIL PROTECTED]
> Subject: RE: response.sendRedirect vs. requestDispatcher.forward
>
>
> Hi,
>
> Thanks for the help. As it turns out, switching
> between requestDispath.forward and response.redirect
> will trip you up because of differences in what they
> expect as their parameters.
>
> RequestDispatch.forward takes a URL that is a RELATIVE
> path but also requires a leading slash.
>
> If you are brilliant (like myself) and you change your
> code to use response.encodeRedirectURL but you KEEP
> that leading slash, well then. Your response will
> treat it like an absolute path and wind up plunking
> you into a different servlet context, which Tomcat
> will generate a new session for.
>
> Thanks again for your help,
> Andy
>
> --- Martin van den Bemt <[EMAIL PROTECTED]> wrote:
> > A different hostname creates a new session which
> > could be the problem here..
> > (so http://www.example.com and http://example.com
> > create a different session even it's the same
> > server/context/etc..
> >
> > Mvgr,
> > Martin
> >
> > > -----Original Message-
> > > From: Alex Fernandez [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, May 29, 2001 4:57 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: response.sendRedirect vs.
> > requestDispatcher.forward
> > >
> > >
> > > Conceptually, requestDispatcher.forward() is
> > different from
> > > response.sendRedirect().
> > >
> > > In forward(), you are moving inside the same
> > webapp, and as such it
> > > doesn't even reach the client browser. The session
> > is maintained.
> > >
> > > In sendRedirect(), you're instead moving across
> > webapps, and it's the
> > > browser that redirects to the specified location.
> > In fact, it doesn't
> > > even need to be another servlet, you may redirect
> > to an ASP or a static
> > > page. New request and response are created.
> > >
> > > It seems strange that the session is not
> > maintained, though, since both
> > > requests come from the same browser. Perhaps it's
> > a bug?
> > >
> > > Un saludo,
> > >
> > > Alex.
> > >
> > > A Yang wrote:
> > > >
> > > > Hi All,
> > > >
> > > > Does anyone know offhand whether the Java
> > Servlet
> > > > specification requires a new HttpSession to be
> > created
> > > > when using HttpServletResponse.sendRedirect()?
> > > >
> > > > In a servlet, I was using:
> > > >
> > > >
> > >
> >
> getServletConfig().getServletContext().getRequestDispatcher("/Resu
> > > lt.jsp").forward(req,
> > > > resp);
> > > >
> > > > at the end of a sequence of pages/servlets, but
> > I
> > > > wanted to replace it with
> > > >
> > > > response.sendRedirect("/Result.jsp");
> > > >
> > > > instead. The result page prints out the contents
> > of
> > > > several javabeans which are stored in the
> > session.
> > > >
> > > > This worked fine when all I used were
> > > > requestDispatcher.forward but with
> > > > response.sendRedirect(), all of my session
> > attributes
> > > > are gone! In fact, the session id is different
> > after
> > > > the sendRedirect.
> > > >
> > > > I'm pretty sure the session is supposed to
> > survive
> > > > across any series of GET's and POST's until it
> > is
> > > > invalidated explicitly (or timed out).
> > > >
> > > > Any thoughts? I'm using Tomcat 3.2.1
> > > >
> > > > Thanks.
> > > >
> > > >
> >
> ___
> > > > Do You Yahoo!?
> > > > Get your free @yahoo.ca address at
> > http://mail.yahoo.ca
> > >
> >
>
>
> ___
> Do You Yahoo!?
> Get your free @yahoo.ca address at http://mail.yahoo.ca
>
>





RE: response.sendRedirect vs. requestDispatcher.forward

2001-05-30 Thread Martin van den Bemt

If you webserver is serving in /usr/local/apache/htdocs, you are redirecting
to /usr/local/apache/htdocs/login.jsp, which is handled in this example by
apache, who doesn't know anything about jsp files. (that's why you got
tomcat in the first place...)

Mvgr,
Martin

> -Original Message-
> From: Brandon Cruz [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 31, 2001 1:31 AM
> To: [EMAIL PROTECTED]
> Subject: RE: response.sendRedirect vs. requestDispatcher.forward
>
>
> Has anyone figured out why response.sendRedirect("/login.jsp")
> will not work
> when using apache-tomcat with mod_jk?  It gets all screwed up and prints a
> bunch of header information out to the page...is there a way around it
> besides using javascript to redirect the page?
>
> Brandon Cruz
>
> -Original Message-
> From: A Yang [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 30, 2001 1:13 PM
> To: [EMAIL PROTECTED]
> Subject: RE: response.sendRedirect vs. requestDispatcher.forward
>
>
> Hi,
>
> Thanks for the help. As it turns out, switching
> between requestDispath.forward and response.redirect
> will trip you up because of differences in what they
> expect as their parameters.
>
> RequestDispatch.forward takes a URL that is a RELATIVE
> path but also requires a leading slash.
>
> If you are brilliant (like myself) and you change your
> code to use response.encodeRedirectURL but you KEEP
> that leading slash, well then. Your response will
> treat it like an absolute path and wind up plunking
> you into a different servlet context, which Tomcat
> will generate a new session for.
>
> Thanks again for your help,
> Andy
>
> --- Martin van den Bemt <[EMAIL PROTECTED]> wrote:
> > A different hostname creates a new session which
> > could be the problem here..
> > (so http://www.example.com and http://example.com
> > create a different session even it's the same
> > server/context/etc..
> >
> > Mvgr,
> > Martin
> >
> > > -----Original Message-
> > > From: Alex Fernandez [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, May 29, 2001 4:57 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: response.sendRedirect vs.
> > requestDispatcher.forward
> > >
> > >
> > > Conceptually, requestDispatcher.forward() is
> > different from
> > > response.sendRedirect().
> > >
> > > In forward(), you are moving inside the same
> > webapp, and as such it
> > > doesn't even reach the client browser. The session
> > is maintained.
> > >
> > > In sendRedirect(), you're instead moving across
> > webapps, and it's the
> > > browser that redirects to the specified location.
> > In fact, it doesn't
> > > even need to be another servlet, you may redirect
> > to an ASP or a static
> > > page. New request and response are created.
> > >
> > > It seems strange that the session is not
> > maintained, though, since both
> > > requests come from the same browser. Perhaps it's
> > a bug?
> > >
> > > Un saludo,
> > >
> > > Alex.
> > >
> > > A Yang wrote:
> > > >
> > > > Hi All,
> > > >
> > > > Does anyone know offhand whether the Java
> > Servlet
> > > > specification requires a new HttpSession to be
> > created
> > > > when using HttpServletResponse.sendRedirect()?
> > > >
> > > > In a servlet, I was using:
> > > >
> > > >
> > >
> >
> getServletConfig().getServletContext().getRequestDispatcher("/Resu
> > > lt.jsp").forward(req,
> > > > resp);
> > > >
> > > > at the end of a sequence of pages/servlets, but
> > I
> > > > wanted to replace it with
> > > >
> > > > response.sendRedirect("/Result.jsp");
> > > >
> > > > instead. The result page prints out the contents
> > of
> > > > several javabeans which are stored in the
> > session.
> > > >
> > > > This worked fine when all I used were
> > > > requestDispatcher.forward but with
> > > > response.sendRedirect(), all of my session
> > attributes
> > > > are gone! In fact, the session id is different
> > after
> > > > the sendRedirect.
> > > >
> > > > I'm pretty sure the session is supposed to
> > survive
> > > > across any series of GET's and POST's until it
> > is
> > > > invalidated explicitly (or timed out).
> > > >
> > > > Any thoughts? I'm using Tomcat 3.2.1
> > > >
> > > > Thanks.
> > > >
> > > >
> >
> ___
> > > > Do You Yahoo!?
> > > > Get your free @yahoo.ca address at
> > http://mail.yahoo.ca
> > >
> >
>
>
> ___
> Do You Yahoo!?
> Get your free @yahoo.ca address at http://mail.yahoo.ca
>
>




RE: response.sendRedirect vs. requestDispatcher.forward

2001-05-30 Thread Brandon Cruz

Has anyone figured out why response.sendRedirect("/login.jsp") will not work
when using apache-tomcat with mod_jk?  It gets all screwed up and prints a
bunch of header information out to the page...is there a way around it
besides using javascript to redirect the page?

Brandon Cruz

-Original Message-
From: A Yang [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 1:13 PM
To: [EMAIL PROTECTED]
Subject: RE: response.sendRedirect vs. requestDispatcher.forward


Hi,

Thanks for the help. As it turns out, switching
between requestDispath.forward and response.redirect
will trip you up because of differences in what they
expect as their parameters.

RequestDispatch.forward takes a URL that is a RELATIVE
path but also requires a leading slash.

If you are brilliant (like myself) and you change your
code to use response.encodeRedirectURL but you KEEP
that leading slash, well then. Your response will
treat it like an absolute path and wind up plunking
you into a different servlet context, which Tomcat
will generate a new session for.

Thanks again for your help,
Andy

--- Martin van den Bemt <[EMAIL PROTECTED]> wrote:
> A different hostname creates a new session which
> could be the problem here..
> (so http://www.example.com and http://example.com
> create a different session even it's the same
> server/context/etc..
>
> Mvgr,
> Martin
>
> > -Original Message-
> > From: Alex Fernandez [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 29, 2001 4:57 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: response.sendRedirect vs.
> requestDispatcher.forward
> >
> >
> > Conceptually, requestDispatcher.forward() is
> different from
> > response.sendRedirect().
> >
> > In forward(), you are moving inside the same
> webapp, and as such it
> > doesn't even reach the client browser. The session
> is maintained.
> >
> > In sendRedirect(), you're instead moving across
> webapps, and it's the
> > browser that redirects to the specified location.
> In fact, it doesn't
> > even need to be another servlet, you may redirect
> to an ASP or a static
> > page. New request and response are created.
> >
> > It seems strange that the session is not
> maintained, though, since both
> > requests come from the same browser. Perhaps it's
> a bug?
> >
> > Un saludo,
> >
> > Alex.
> >
> > A Yang wrote:
> > >
> > > Hi All,
> > >
> > > Does anyone know offhand whether the Java
> Servlet
> > > specification requires a new HttpSession to be
> created
> > > when using HttpServletResponse.sendRedirect()?
> > >
> > > In a servlet, I was using:
> > >
> > >
> >
>
getServletConfig().getServletContext().getRequestDispatcher("/Resu
> > lt.jsp").forward(req,
> > > resp);
> > >
> > > at the end of a sequence of pages/servlets, but
> I
> > > wanted to replace it with
> > >
> > > response.sendRedirect("/Result.jsp");
> > >
> > > instead. The result page prints out the contents
> of
> > > several javabeans which are stored in the
> session.
> > >
> > > This worked fine when all I used were
> > > requestDispatcher.forward but with
> > > response.sendRedirect(), all of my session
> attributes
> > > are gone! In fact, the session id is different
> after
> > > the sendRedirect.
> > >
> > > I'm pretty sure the session is supposed to
> survive
> > > across any series of GET's and POST's until it
> is
> > > invalidated explicitly (or timed out).
> > >
> > > Any thoughts? I'm using Tomcat 3.2.1
> > >
> > > Thanks.
> > >
> > >
>
___
> > > Do You Yahoo!?
> > > Get your free @yahoo.ca address at
> http://mail.yahoo.ca
> >
>


___
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca




RE: response.sendRedirect vs. requestDispatcher.forward

2001-05-30 Thread A Yang

Hi,

Thanks for the help. As it turns out, switching
between requestDispath.forward and response.redirect
will trip you up because of differences in what they
expect as their parameters.

RequestDispatch.forward takes a URL that is a RELATIVE
path but also requires a leading slash.

If you are brilliant (like myself) and you change your
code to use response.encodeRedirectURL but you KEEP
that leading slash, well then. Your response will
treat it like an absolute path and wind up plunking
you into a different servlet context, which Tomcat
will generate a new session for.

Thanks again for your help,
Andy

--- Martin van den Bemt <[EMAIL PROTECTED]> wrote:
> A different hostname creates a new session which
> could be the problem here..
> (so http://www.example.com and http://example.com
> create a different session even it's the same 
> server/context/etc..
> 
> Mvgr,
> Martin
> 
> > -Original Message-
> > From: Alex Fernandez [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 29, 2001 4:57 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: response.sendRedirect vs.
> requestDispatcher.forward
> >
> >
> > Conceptually, requestDispatcher.forward() is
> different from
> > response.sendRedirect().
> >
> > In forward(), you are moving inside the same
> webapp, and as such it
> > doesn't even reach the client browser. The session
> is maintained.
> >
> > In sendRedirect(), you're instead moving across
> webapps, and it's the
> > browser that redirects to the specified location.
> In fact, it doesn't
> > even need to be another servlet, you may redirect
> to an ASP or a static
> > page. New request and response are created.
> >
> > It seems strange that the session is not
> maintained, though, since both
> > requests come from the same browser. Perhaps it's
> a bug?
> >
> > Un saludo,
> >
> > Alex.
> >
> > A Yang wrote:
> > >
> > > Hi All,
> > >
> > > Does anyone know offhand whether the Java
> Servlet
> > > specification requires a new HttpSession to be
> created
> > > when using HttpServletResponse.sendRedirect()?
> > >
> > > In a servlet, I was using:
> > >
> > >
> >
>
getServletConfig().getServletContext().getRequestDispatcher("/Resu
> > lt.jsp").forward(req,
> > > resp);
> > >
> > > at the end of a sequence of pages/servlets, but
> I
> > > wanted to replace it with
> > >
> > > response.sendRedirect("/Result.jsp");
> > >
> > > instead. The result page prints out the contents
> of
> > > several javabeans which are stored in the
> session.
> > >
> > > This worked fine when all I used were
> > > requestDispatcher.forward but with
> > > response.sendRedirect(), all of my session
> attributes
> > > are gone! In fact, the session id is different
> after
> > > the sendRedirect.
> > >
> > > I'm pretty sure the session is supposed to
> survive
> > > across any series of GET's and POST's until it
> is
> > > invalidated explicitly (or timed out).
> > >
> > > Any thoughts? I'm using Tomcat 3.2.1
> > >
> > > Thanks.
> > >
> > >
>
___
> > > Do You Yahoo!?
> > > Get your free @yahoo.ca address at
> http://mail.yahoo.ca
> >
> 


___
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca



RE: response.sendRedirect vs. requestDispatcher.forward

2001-05-29 Thread Martin van den Bemt

A different hostname creates a new session which could be the problem here..
(so http://www.example.com and http://example.com create a different session
even it's the same server/context/etc..

Mvgr,
Martin

> -Original Message-
> From: Alex Fernandez [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 29, 2001 4:57 PM
> To: [EMAIL PROTECTED]
> Subject: Re: response.sendRedirect vs. requestDispatcher.forward
>
>
> Conceptually, requestDispatcher.forward() is different from
> response.sendRedirect().
>
> In forward(), you are moving inside the same webapp, and as such it
> doesn't even reach the client browser. The session is maintained.
>
> In sendRedirect(), you're instead moving across webapps, and it's the
> browser that redirects to the specified location. In fact, it doesn't
> even need to be another servlet, you may redirect to an ASP or a static
> page. New request and response are created.
>
> It seems strange that the session is not maintained, though, since both
> requests come from the same browser. Perhaps it's a bug?
>
> Un saludo,
>
> Alex.
>
> A Yang wrote:
> >
> > Hi All,
> >
> > Does anyone know offhand whether the Java Servlet
> > specification requires a new HttpSession to be created
> > when using HttpServletResponse.sendRedirect()?
> >
> > In a servlet, I was using:
> >
> >
> getServletConfig().getServletContext().getRequestDispatcher("/Resu
> lt.jsp").forward(req,
> > resp);
> >
> > at the end of a sequence of pages/servlets, but I
> > wanted to replace it with
> >
> > response.sendRedirect("/Result.jsp");
> >
> > instead. The result page prints out the contents of
> > several javabeans which are stored in the session.
> >
> > This worked fine when all I used were
> > requestDispatcher.forward but with
> > response.sendRedirect(), all of my session attributes
> > are gone! In fact, the session id is different after
> > the sendRedirect.
> >
> > I'm pretty sure the session is supposed to survive
> > across any series of GET's and POST's until it is
> > invalidated explicitly (or timed out).
> >
> > Any thoughts? I'm using Tomcat 3.2.1
> >
> > Thanks.
> >
> > ___
> > Do You Yahoo!?
> > Get your free @yahoo.ca address at http://mail.yahoo.ca
>




AW: response.sendRedirect vs. requestDispatcher.forward

2001-05-29 Thread Ralph Einfeldt

Try this one:

response.sendRedirect(response.encodeRedirectUrl("/Result.jsp"));

> -Ursprüngliche Nachricht-
> Von: A Yang [mailto:[EMAIL PROTECTED]]
> Gesendet: Dienstag, 29. Mai 2001 16:21
> An: [EMAIL PROTECTED]
> Betreff: response.sendRedirect vs. requestDispatcher.forward

> response.sendRedirect("/Result.jsp");




Re: response.sendRedirect vs. requestDispatcher.forward

2001-05-29 Thread Alex Fernández

Conceptually, requestDispatcher.forward() is different from
response.sendRedirect().

In forward(), you are moving inside the same webapp, and as such it
doesn't even reach the client browser. The session is maintained.

In sendRedirect(), you're instead moving across webapps, and it's the
browser that redirects to the specified location. In fact, it doesn't
even need to be another servlet, you may redirect to an ASP or a static
page. New request and response are created.

It seems strange that the session is not maintained, though, since both
requests come from the same browser. Perhaps it's a bug?

Un saludo,

Alex.

A Yang wrote:
> 
> Hi All,
> 
> Does anyone know offhand whether the Java Servlet
> specification requires a new HttpSession to be created
> when using HttpServletResponse.sendRedirect()?
> 
> In a servlet, I was using:
> 
> 
>getServletConfig().getServletContext().getRequestDispatcher("/Result.jsp").forward(req,
> resp);
> 
> at the end of a sequence of pages/servlets, but I
> wanted to replace it with
> 
> response.sendRedirect("/Result.jsp");
> 
> instead. The result page prints out the contents of
> several javabeans which are stored in the session.
> 
> This worked fine when all I used were
> requestDispatcher.forward but with
> response.sendRedirect(), all of my session attributes
> are gone! In fact, the session id is different after
> the sendRedirect.
> 
> I'm pretty sure the session is supposed to survive
> across any series of GET's and POST's until it is
> invalidated explicitly (or timed out).
> 
> Any thoughts? I'm using Tomcat 3.2.1
> 
> Thanks.
> 
> ___
> Do You Yahoo!?
> Get your free @yahoo.ca address at http://mail.yahoo.ca



response.sendRedirect vs. requestDispatcher.forward

2001-05-29 Thread A Yang

Hi All,

Does anyone know offhand whether the Java Servlet
specification requires a new HttpSession to be created
when using HttpServletResponse.sendRedirect()?

In a servlet, I was using:

getServletConfig().getServletContext().getRequestDispatcher("/Result.jsp").forward(req,
resp);

at the end of a sequence of pages/servlets, but I
wanted to replace it with

response.sendRedirect("/Result.jsp");

instead. The result page prints out the contents of
several javabeans which are stored in the session.

This worked fine when all I used were
requestDispatcher.forward but with
response.sendRedirect(), all of my session attributes
are gone! In fact, the session id is different after
the sendRedirect.

I'm pretty sure the session is supposed to survive
across any series of GET's and POST's until it is
invalidated explicitly (or timed out).

Any thoughts? I'm using Tomcat 3.2.1

Thanks.

___
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca



RequestDispatcher.include(String)/RequestDispatcher.forward(String)

2001-05-25 Thread Marco Baringer

Let's say I have a site where I map every URL to the same servlet,
there's something like this in my web.xml


  bob
  *


This precludes me from having anything else on my site, which is ok
with me, almost. My servlets usually do their work and then use a
forward or an include to get a jsp page to view the results, however
in this case whatever jsp i try to include i get the servlet, the
servlet starts trying to include itself and it takes about 4 seconds
to a stack overflow in the JVM. Even if I have a jsp in the context
tomcat always calls the servlet. this is being done because i have a
site with one and only servlet which takes one and only parameter and
so i've decided to use the name i call the servlet with (the URI) as
the parameter. This solution is simple and I wuite like it, but I
can't show the results short of the servlet use
Request.getWriter().print(...) which is something I'd rather avoid.

Question: 
1) Can I include a resource which is on the file system and bypass
tomcat's parsing of the resource (i want /t.jsp and not to call the
servlet as /t.jsp)?

2) if not can i exclude some urls from the url-pattern?

-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There's a crack in everything.
It's how the light gets in.
-Isonard Cohen

 PGP signature


Re: RequestDispatcher.forward()

2001-05-21 Thread Sebastian Schulz

thank you all for suggestions and help!

special thanks to jeff, Http(s)Message works fine for
me and solves my problem.

basti




Jeff Kilbride wrote:

> Check out the HttpMessage and HttpsMessage classes in the
> com.oreilly.servlet package available from Jason Hunter at www.servlets.com.
>
> Does the same basic connection stuff and returns an InputStream which you
> can wrap in a BufferedReader like Eric does below. The nice thing is that it
> does secure ssl (https) connections also with the JSSE jar files -- and it's
> very easy to setup and use.
>
> Thanks,
> --jeff
>
> - Original Message -
> From: "Eric Lubin" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, May 18, 2001 8:58 AM
> Subject: Re: RequestDispatcher.forward()
>
> > package com.ibm.servconn;
> > import java.net.*;
> > import java.io.*;
> > import java.util.*;
> > import com.ibm.aurora.*;
> >
> > public class URLForward {
> >
> >private String theURL;
> >private String method;
> >
> >public URLForward( String theURL ) {
> >   this(theURL,"POST");
> >}
> >public URLForward( String theURL, String method ) {
> >   this.theURL = theURL;
> >   this.method = method;
> >}
> >
> >public String[] execute() throws BehaviorException {
> >   Vector v = new Vector();
> >   try {
> >  URL theServlet = new URL(theURL);
> >   // establish a connection with the server, but do not connect to
> > the servlet yet
> >  HttpURLConnection theConnection
> > = (HttpURLConnection)theServlet.openConnection();
> >  theConnection.setRequestMethod(method);
> >   // now we can connect to the page
> >  theConnection.connect();
> >   // read the results from the servlet as a String
> >  BufferedReader in = new BufferedReader(new
> > InputStreamReader(theConnection.getInputStream()));
> >  String inputLine;
> >  while ((inputLine = in.readLine()) != null) {
> > v.addElement(inputLine);
> >  }
> >  in.close();
> >  String da[] = new String[v.size()];
> >  v.copyInto(da);
> >  return da;
> >   }
> >// have to handle these somehow
> >   catch( MalformedURLException mue ) {
> >  throw new BehaviorException("Malformed URL
> > address",ServConnBhvrErrors.MALFORMED_URL,mue);
> >   }
> >   catch( IOException ioe ) {
> >  throw new BehaviorException("IOException - the translator might
> be
> > down",ServConnBhvrErrors.CANT_CONNECT_TO_SERVER,ioe);
> >   }
> >}
> > }
> >
> > Eric Lubin
> > T/L 443-6954  External:  561-443-6954
> > Notes ID:  elubin@ibmusm20External: [EMAIL PROTECTED]
> >
> >
> > Sebastian Schulz <[EMAIL PROTECTED]> on 05/18/2001
> > 10:58:33 AM
> >
> > Please respond to [EMAIL PROTECTED]
> >
> > To:   [EMAIL PROTECTED]
> > cc:
> > Subject:  RequestDispatcher.forward()
> >
> >
> >
> > hi,
> >
> > has somebody a work-around to produce the
> > same behavior as if RequestDispatcher.forward()
> > would work with absolute URL's?
> >
> > tanks in advance!
> >
> > basti
> >
> >
> >




Re: RequestDispatcher.forward()

2001-05-18 Thread Jeff Kilbride

Check out the HttpMessage and HttpsMessage classes in the
com.oreilly.servlet package available from Jason Hunter at www.servlets.com.

Does the same basic connection stuff and returns an InputStream which you
can wrap in a BufferedReader like Eric does below. The nice thing is that it
does secure ssl (https) connections also with the JSSE jar files -- and it's
very easy to setup and use.

Thanks,
--jeff

- Original Message -
From: "Eric Lubin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 18, 2001 8:58 AM
Subject: Re: RequestDispatcher.forward()


> package com.ibm.servconn;
> import java.net.*;
> import java.io.*;
> import java.util.*;
> import com.ibm.aurora.*;
>
> public class URLForward {
>
>private String theURL;
>private String method;
>
>public URLForward( String theURL ) {
>   this(theURL,"POST");
>}
>public URLForward( String theURL, String method ) {
>   this.theURL = theURL;
>   this.method = method;
>}
>
>public String[] execute() throws BehaviorException {
>   Vector v = new Vector();
>   try {
>  URL theServlet = new URL(theURL);
>   // establish a connection with the server, but do not connect to
> the servlet yet
>  HttpURLConnection theConnection
> = (HttpURLConnection)theServlet.openConnection();
>  theConnection.setRequestMethod(method);
>   // now we can connect to the page
>  theConnection.connect();
>   // read the results from the servlet as a String
>  BufferedReader in = new BufferedReader(new
> InputStreamReader(theConnection.getInputStream()));
>  String inputLine;
>  while ((inputLine = in.readLine()) != null) {
> v.addElement(inputLine);
>  }
>  in.close();
>  String da[] = new String[v.size()];
>  v.copyInto(da);
>  return da;
>   }
>// have to handle these somehow
>   catch( MalformedURLException mue ) {
>  throw new BehaviorException("Malformed URL
> address",ServConnBhvrErrors.MALFORMED_URL,mue);
>   }
>   catch( IOException ioe ) {
>  throw new BehaviorException("IOException - the translator might
be
> down",ServConnBhvrErrors.CANT_CONNECT_TO_SERVER,ioe);
>   }
>}
> }
>
> Eric Lubin
> T/L 443-6954  External:  561-443-6954
> Notes ID:  elubin@ibmusm20External: [EMAIL PROTECTED]
>
>
> Sebastian Schulz <[EMAIL PROTECTED]> on 05/18/2001
> 10:58:33 AM
>
> Please respond to [EMAIL PROTECTED]
>
> To:   [EMAIL PROTECTED]
> cc:
> Subject:  RequestDispatcher.forward()
>
>
>
> hi,
>
> has somebody a work-around to produce the
> same behavior as if RequestDispatcher.forward()
> would work with absolute URL's?
>
> tanks in advance!
>
> basti
>
>
>




Re: RequestDispatcher.forward()

2001-05-18 Thread Eric Lubin

package com.ibm.servconn;
import java.net.*;
import java.io.*;
import java.util.*;
import com.ibm.aurora.*;

public class URLForward {

   private String theURL;
   private String method;

   public URLForward( String theURL ) {
  this(theURL,"POST");
   }
   public URLForward( String theURL, String method ) {
  this.theURL = theURL;
  this.method = method;
   }

   public String[] execute() throws BehaviorException {
  Vector v = new Vector();
  try {
 URL theServlet = new URL(theURL);
  // establish a connection with the server, but do not connect to
the servlet yet
 HttpURLConnection theConnection
= (HttpURLConnection)theServlet.openConnection();
 theConnection.setRequestMethod(method);
  // now we can connect to the page
 theConnection.connect();
  // read the results from the servlet as a String
 BufferedReader in = new BufferedReader(new
InputStreamReader(theConnection.getInputStream()));
 String inputLine;
 while ((inputLine = in.readLine()) != null) {
v.addElement(inputLine);
 }
 in.close();
 String da[] = new String[v.size()];
 v.copyInto(da);
 return da;
  }
   // have to handle these somehow
  catch( MalformedURLException mue ) {
 throw new BehaviorException("Malformed URL
address",ServConnBhvrErrors.MALFORMED_URL,mue);
  }
  catch( IOException ioe ) {
 throw new BehaviorException("IOException - the translator might be
down",ServConnBhvrErrors.CANT_CONNECT_TO_SERVER,ioe);
  }
   }
}

Eric Lubin
T/L 443-6954  External:  561-443-6954
Notes ID:  elubin@ibmusm20External: [EMAIL PROTECTED]


Sebastian Schulz <[EMAIL PROTECTED]> on 05/18/2001
10:58:33 AM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  RequestDispatcher.forward()



hi,

has somebody a work-around to produce the
same behavior as if RequestDispatcher.forward()
would work with absolute URL's?

tanks in advance!

basti






RE: RequestDispatcher.forward()

2001-05-18 Thread Grewal, Gary
Title: RE: RequestDispatcher.forward()





ServletContext.getRequestDispatcher(java.lang.String path) takes absolute path beginign with / though the path must be relative to the current context.

You will have to use getContext(java.lang.String uripath) to get a foreign Context and then use this to get the Request Dispatcher for other context 's

Thanks and Regards,


===
Gary Grewal



-Original Message-
From: Sebastian Schulz [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 18, 2001 9:59 AM
To: [EMAIL PROTECTED]
Subject: RequestDispatcher.forward()



hi,


has somebody a work-around to produce the
same behavior as if RequestDispatcher.forward()
would work with absolute URL's?


tanks in advance!


basti





RequestDispatcher.forward()

2001-05-18 Thread Sebastian Schulz

hi,

has somebody a work-around to produce the
same behavior as if RequestDispatcher.forward()
would work with absolute URL's?

tanks in advance!

basti




Re: RequestDispatcher.forward()

2001-05-18 Thread Sebastian Schulz

???

> are you shobhit sati from india?
> sorry if I am wrong

no ;-)

basti




RE: RequestDispatcher.forward()

2001-05-18 Thread Raj Agrawal

are you shobhit sati from india?
sorry if I am wrong

Raj

-Original Message-
From: Sebastian Schulz [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 18, 2001 2:24 PM
To: [EMAIL PROTECTED]
Subject: RequestDispatcher.forward()


hi!

my problem is, that i have a 'virtual' url that is
a servlet, and a mapping from that virtual url
to a 'real' url outside of the servletcontext.

i want the user never to use or bookmark the
'real' url but allways the 'virtual'.
the .forward()-method would be a cool solution to
manage this, but unfortunately the 'real' urls are not
in the context, and forward() doesn`t work with
absolute urls.

if i use sendRedirect() instead, the user sees the
'real' url, and thats bad for my application.

is there a possibility to approach the desired behavior
(allways 'virtual' urls)?

i would be delighted to get some suggestions, tricks ...

many thanks in advance!

basti





RequestDispatcher.forward()

2001-05-18 Thread Sebastian Schulz

hi!

my problem is, that i have a 'virtual' url that is
a servlet, and a mapping from that virtual url
to a 'real' url outside of the servletcontext.

i want the user never to use or bookmark the
'real' url but allways the 'virtual'.
the .forward()-method would be a cool solution to
manage this, but unfortunately the 'real' urls are not
in the context, and forward() doesn`t work with
absolute urls.

if i use sendRedirect() instead, the user sees the
'real' url, and thats bad for my application.

is there a possibility to approach the desired behavior
(allways 'virtual' urls)?

i would be delighted to get some suggestions, tricks ...

many thanks in advance!

basti




URL rewriting + RequestDispatcher.forward(...)

2001-05-07 Thread Zimmerer, Ralf

Hello,

our configuration is as follows:

Production:

RedHat 6.1
IBM JDK 1.1.8
Apache httpd 1.3 9
Tomcat 3.2.1

Development:

Win NT 4.0/Win 98
IBM JDK 1.1.8
Apache httpd 1.3 9
Tomcat 3.2.1


The developed application works fine with cookie browser support,
but without cookie support, we run in one special problem.

We use mod_rewrite in Apache httpd in order to handle URL's like:

http://www.domain.com/shop/cashstyle.jsp;jsessionid=7y5yoj91n2?act=start&ste
p=1

This works right.

In the Java application we use response.encodeURL(...)
to instruct Tomcat to generate an URL with the current session id.

This method call we use in different JSP-files, but also in
public methods of some JavaBeans, which generates HTML output.


Let's construct the following situation:
=

We have a method, that construct the following URL:

1.  with cookie support
url_1 = http://www.domain.com/shop/cashstyle.jsp?act=start&step=1

2.  with URL rewriting
url_2 =
http://www.domain.com/shop/cashstyle.jsp;jsessionid=7y5yoj91n2?act=start&ste
p=1


When we now use the two constructed url's with the following
method calls, we get different results:

context.getRequestDispatcher(url_1).include(request, response);
result: O.K., page with url_1 will be included ...

context.getRequestDispatcher(url_1).forward(request, response);
result: O.K., it will be forwarded to the page with url_1

context.getRequestDispatcher(url_2).include(request, response);
result: O.K., page with url_2 will be included ...

context.getRequestDispatcher(url_2).forward(request, response);
result: FAILED, NO FORWARDING !!!


We have now implemented as workaround a method, that looks for a
session id in the path parameter, if a RequestDispatcher.forward(...)
should be processed, and cuts it (;jsessionid=xyz24356).

But this isn't a nice solution !!!

QUESTION:
Why doesn't work a forward with an URL with a jsessionid ?


Thanks in advance,
Ralf Zimmerer.

(temporary at Dresdner Bank: [EMAIL PROTECTED])

NINA.de Internet Service Agentur
http://www.nina.de/
http://www.liveshop.de/







Re: calling RequestDispatcher.forward() after RequestDispatcher.include()

2001-03-23 Thread William Au

This seems to be caused by a bug in Tomcat 3.2.1.  I looked at the java
code
generated for my JSP.  It call out.flush() at the end.  I think that's why
the
forward() failed.  I then converted example1.jsp from JSPs to servlets but
I am still getting the same Exception.  Moving my code below from a JSP
to a servlet did not help.  I check the Servlet 2.2 spec and it does not
mention
anything about flushing or committing the output when using
RequestDispatcher.include().  Anyone knows if this bug exists in later
version
of Tomcat also.

On a related note.  I noticed that Tomcat always call out.flush() in the
java
code it generates for JSP.  Isn't that a bug?

Bill

William Au wrote:

> I am running Tomcat 3.2.1.
>
> I am getting the following error.
>
> javax.servlet.ServletException: Cannot forward as OutputStream or Writer
> has already been obtained
>
> My code is quite simple.  The jsp that I am including, example1.jsp,
> does not write anything to the
> output buffer.
>
> <%
> RequestDispatcher rd1 =
>   request.getRequestDispatcher("example1.jsp");
> rd1.include(request, response);
>
> RequestDispatcher rd2 =
>   request.getRequestDispatcher("example2.jsp");
> rd2.forward(request, response);
> %>
>
> The Apache Bug Database, bug #250, said this is fixed in 3.2.  Is there
> something
> wrong with my code?
>
> Bill




calling RequestDispatcher.forward() after RequestDispatcher.include()

2001-03-21 Thread William Au

I am running Tomcat 3.2.1.

I am getting the following error.

javax.servlet.ServletException: Cannot forward as OutputStream or Writer
has already been obtained

My code is quite simple.  The jsp that I am including, example1.jsp,
does not write anything to the
output buffer.

<%
RequestDispatcher rd1 =
  request.getRequestDispatcher("example1.jsp");
rd1.include(request, response);

RequestDispatcher rd2 =
  request.getRequestDispatcher("example2.jsp");
rd2.forward(request, response);
%>

The Apache Bug Database, bug #250, said this is fixed in 3.2.  Is there
something
wrong with my code?

Bill




Re: RequestDispatcher.forward()-Problem with anchors

2001-03-06 Thread Alex Fernández

Hi Sebastian,

Sebastian Schulz wrote:

> is there a trick to anyhow get some related behavior
> with forward to work?
>
> or is this not necessary, because i can  access the
> original session object at the second
> page in the case of a redirect as well?

I think so. If you want to send an error, store it in the session and check
it in the receiving servlet.

Un saludo,

Alex.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: RequestDispatcher.forward()-Problem with anchors

2001-03-06 Thread Sebastian Schulz

thank you, Rob!
(thank you, Michael)

... it sounds consistent. once more again to
secure, i understand it correct:

a forward in opposition to a redirect is some
server-internal operation, whose result is send
back to the browser. as the browser itself don't realize it,
the anchor at the url has not the desired effect.

ok. that a redirection with a anchor-url operates, is
clear.

is there a trick to anyhow get some related behavior
with forward to work?

or is this not necessary, because i can  access the
original session object at the second
page in the case of a redirect as well?
(i think this was my error in reasoning, that i have to
use a forward when using sessions)

thank you again,

bAs T.



Rob Tanner schrieb:

> When you do a RequestDispatcher.forward(), that's an internal
> operation, and not a redirect send back to the browser.  In the latter
> case, the browser initiates a new GET request to the new URL.  In the
> former case, the page at the RequestDispatcher.forward() address is
> simply sent to the browser without the browser being any the wiser.  In
> that sense, it's the same kind of thing as an internal redirect in
> Apache.
>
> Whether the address "example.jsp#position1" is a good URL or a bad URL
> or whether it's a tomcat bug or a serverlet 2.2 spec bug that an
> exception wasn't thrown is something I don't know.  But going back to
> my first point, since the browser is unaware of the forward anyway,
> anchors won't work.  Do a redirect to the browser instead.
>
> -- Rob
>
> --On Monday, March 05, 2001 10:09:24 AM -0800 Filip Hanik
> <[EMAIL PROTECTED]> wrote:
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: RequestDispatcher.forward()-Problem with anchors

2001-03-05 Thread Rob Tanner

When you do a RequestDispatcher.forward(), that's an internal 
operation, and not a redirect send back to the browser.  In the latter 
case, the browser initiates a new GET request to the new URL.  In the 
former case, the page at the RequestDispatcher.forward() address is 
simply sent to the browser without the browser being any the wiser.  In 
that sense, it's the same kind of thing as an internal redirect in 
Apache.

Whether the address "example.jsp#position1" is a good URL or a bad URL 
or whether it's a tomcat bug or a serverlet 2.2 spec bug that an 
exception wasn't thrown is something I don't know.  But going back to 
my first point, since the browser is unaware of the forward anyway, 
anchors won't work.  Do a redirect to the browser instead.

-- Rob

--On Monday, March 05, 2001 10:09:24 AM -0800 Filip Hanik 
<[EMAIL PROTECTED]> wrote:

> I thought the anchor tag was something that was interpreted by the
> browser, not the server.
> doesn't the server just ignore those?
>
> correct me if I am wrong!
>
> Filip
>
>> -Original Message-
>> From: Sebastian Schulz [mailto:[EMAIL PROTECTED]]
>> Sent: Monday, March 05, 2001 9:48 AM
>> To: [EMAIL PROTECTED]
>> Subject: RequestDispatcher.forward()-Problem with anchors
>>
>>
>> hi,
>>
>> i have a problem with RequestDispatcher.forward():
>> if the url contains an anchor like "example.jsp#position1"
>> then forwarding seams to be be all right (no error, exception ...),
>> but the 'new' page has no content.
>>
>> i tried to forward to a url with parameters like
>> "example.jsp?name=value", this is no problem and
>> the page is shown correctly?
>>
>> whats my mistake?
>> is it possible to forward a anchor-containing url
>> at all?
>>
>> any suggestions desired!
>>
>> thank you all in advance,
>>
>> bas T.
>>
>>
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, email: [EMAIL PROTECTED]
>>
>>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>




   _ _ _ _   __ _ _ _ _
  /\_\_\_\_\/\_\ /\_\_\_\_\_\
 /\/_/_/_/_/   /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
/\/_/__\/_/ __/\/_//\/_/  PROFUNDUM VIDITUR
   /\/_/_/_/_/ /\_\  /\/_//\/_/
  /\/_/ \/_/  /\/_/_/\/_//\/_/ (Whatever is said in Latin
  \/_/  \/_/  \/_/_/_/_/ \/_/  appears profound)

  Rob Tanner
  McMinnville, Oregon
  [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: RequestDispatcher.forward()-Problem with anchors

2001-03-05 Thread Michael Wentzel

> I thought the anchor tag was something that was interpreted 
> by the browser,
> not the server.
> doesn't the server just ignore those?
> 
> correct me if I am wrong!
> 
> Filip

Yes, this is correct.  The server just streams HTML to the client
and the client interprets that stream and renders it correctly.
This is the reason for the difference in appearance of a page 
between IE and Netscape.

Sebastian-

A few of checks:
1. put debug statements in your target jsp to make sure the
   corresponding servlet is getting the request.
2. Check tomcat logs to see if the requests are getting passed
   around incorrectly if something is wrong with step 1.
3. Check your url right before you make the request to forward
   to make sure it is formed correctly.
4. Are there any errors occuring or does it simply load an
   empty browser page?


---
Michael Wentzel
Software Developer
Software As We Think - http://www.aswethink.com
mailto:[EMAIL PROTECTED]

- Punisher of those who cannot spell dumb!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: RequestDispatcher.forward()-Problem with anchors

2001-03-05 Thread Filip Hanik

I thought the anchor tag was something that was interpreted by the browser,
not the server.
doesn't the server just ignore those?

correct me if I am wrong!

Filip

> -Original Message-
> From: Sebastian Schulz [mailto:[EMAIL PROTECTED]]
> Sent: Monday, March 05, 2001 9:48 AM
> To: [EMAIL PROTECTED]
> Subject: RequestDispatcher.forward()-Problem with anchors
>
>
> hi,
>
> i have a problem with RequestDispatcher.forward():
> if the url contains an anchor like "example.jsp#position1"
> then forwarding seams to be be all right (no error, exception ...),
> but the 'new' page has no content.
>
> i tried to forward to a url with parameters like
> "example.jsp?name=value", this is no problem and
> the page is shown correctly?
>
> whats my mistake?
> is it possible to forward a anchor-containing url
> at all?
>
> any suggestions desired!
>
> thank you all in advance,
>
> bas T.
>
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RequestDispatcher.forward()-Problem with anchors

2001-03-05 Thread Sebastian Schulz

hi,

i have a problem with RequestDispatcher.forward():
if the url contains an anchor like "example.jsp#position1"
then forwarding seams to be be all right (no error, exception ...),
but the 'new' page has no content.

i tried to forward to a url with parameters like
"example.jsp?name=value", this is no problem and
the page is shown correctly?

whats my mistake?
is it possible to forward a anchor-containing url
at all?

any suggestions desired!

thank you all in advance,

bas T.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RequestDispatcher.forward()-Problem with anchors

2001-03-05 Thread Sebastian Schulz

hi,

i have a problem with RequestDispatcher.forward():
if the url contains an anchor like "example.jsp#position1"
then forwarding seams to be be all right (no error, exception ...),
but the 'new' page has no content.

i tried to forward to a url with parameters like
"example.jsp?name=value", this is no problem and
the page is shown correctly?

whats my mistake?
is it possible to forward a anchor-containing url
at all?

any suggestions desired!

thank you all in advance,

bas T.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Problem with RequestDispatcher.forward() and mutlipart/form-data request

2001-03-01 Thread Matthew Sinclair
Title: Problem with RequestDispatcher.forward() and mutlipart/form-data request





I have a very strange problem with the RequestDispatcher.forward()
command. I am trying to forward to a very simple JSP from within
a servlet after handling a request of type="multipart/form-data".


I am using the following HTML to attempt to upload a file:


  ...
  
    Please specify file for upload:
    
    
    
  
  ...


and handling it within the servlet using the MultipartRequest
object from the "com.oreilly.servlet" package of servlet utilities.


  ... service(... req, ... res) throws IOException
  {
    try
    {
  ArrayList    finfos = new ArrayList();
  MultipartRequest multi  = new MultipartRequest(req, ".");
  Enumeration  files  = multi.getFileNames();


  while (files.hasMoreElements())
  {
    String name = (String)files.nextElement();
    String filename = multi.getFilesystemName(name);
    String type = multi.getContentType(name);
    File   f    = multi.getFile(name);
    if (f!=null)
    {
  String[] finfo  = new String[] { name, filename, type, ""+f.length() };
  finfos.add(finfo);
    }
  }
  req.setAttribute("finfos", finfos);
  System.out.print("Forwarding ... ");
  RequestDispatcher rd = getServletContext()
    .getRequestDispatcher("/uploadedfiles.jsp");
  rd.include(req, res);
  System.out.println("Done");
    }
    catch (IOException e)
    {
  e.printStackTrace();
  System.out.print("Error ... ");
  try
  {
    RequestDispatcher rd = getServletContext()
  .getRequestDispatcher("/error.jsp");
    rd.forward(req, res);
  }
  catch (Exception ignore)
  {
    System.out.println("Error with inner forward.");
  }
  System.out.println("Done");
    }
    catch (Exception ignore)
    {
  ignore.printStackTrace();
  System.out.println("Error with outer forward.");
    }
  }
  ...



The main problem is that the forward() call (right after the 
1st IOException has been thrown) results in some very strange
behavior. As far as the servlet is concerned, the forward 
call seems to work, ie there is no exception thrown. But
the forwarded-to jsp is never called up. The browser (IE5.5)
presents an error page: 


  "The page cannot be displayed. 
  The page you are looking for is currently unavailable. The 
  Web site might be experiencing technical difficulties, or 
  you may need to adjust your browser settings."


The really wierd thing is that this error only happens when
the file that is uploaded is of a certain size. If the file
is small, there is no problems, but if the file is large, then
the forward breaks. Interestingly, if I just comment out the
lines that instantiate the MultipartRequest and query it for
the uploaded file and go straight into the forward, it will
allways fail, no matter how big the uploaded file is.


I think (and this is just a guess) that there is something odd
going on with the forward() call when the request is of content
type "multipart/form-data". Although, I am at a complete loss as
to how the content type of the request, has anything to do with
the response.


Of course (as usual with technical problems that I seem to get
myself into) I am well prepared to have fundamentally missed
something!


Any help would be much appreciated.


Cheers,
M@





Re: RequestDispatcher.forward() problem

2001-02-21 Thread Dmitry Rogatkin

I met the same problem. To read your query string in included or forwarded servlet, 
you have to use the call:

String query = request.getAttribute("javax.servlet.include.query_string");

Regards,
Dmitry R., [EMAIL PROTECTED]
Chief Architect, MetricStream.COM
Santa Clara, CA






-Original Message-
From:paul marshal [EMAIL PROTECTED]
Sent:Wed, 21 Feb 2001 16:48:26 +0100
To:  [EMAIL PROTECTED]
Subject: Re: RequestDispatcher.forward() problem


Andrew Kerr wrote:
> 
> Hello,
> 
> I've been having a bit of trouble with the RequestDispatcher.forward()
> method.  If I try to forward to a URL with a query string on it, and
> then have some code that processes the forwarded request, the
> getQueryString() method does not return the query string.  However, the
> parameters _are_ available via getParameter().
> 
> Section 8.1.1 of the Servlet 2.2 spec does not explicitly state what the
> getQueryString() method should return in the event of a forward, but it
> seems to me that if the new request parameters are added to the
> request's internal list of parameters, that it only makes sense to also
> add the parameters to the query string.
> 
> Section 8.4 of the spec states that "the path elements of the request
> object reflect those of the original request."  Although a query string
> is not strictly considered a "path element" according to the spec, it
> does seem in the spirit of section 8.4 that the additional parameters
> should be on the query string.
> 
> Does anyone have any thoughts on this?
> 
> Thanks,
> Andrew

Hi !

I can't answer your exact question. 
But for many purposes - other than reusing an existing servlet class
that you forward to - 

request.setAttribute("name" , valueObject) ; 
RequestDispatcher dest = context.getRequestDispatcher("..."); 
dest.forward(request,response); 

will do. 

-- 
Paul Marshall
[EMAIL PROTECTED]
089/26019-609

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




___
Visit http://www.visto.com/info, your free web-based communications center.
Visto.com. Life on the Dot.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RequestDispatcher.forward() problem

2001-02-21 Thread Andrew Kerr

Hello,

I've been having a bit of trouble with the RequestDispatcher.forward()
method.  If I try to forward to a URL with a query string on it, and
then have some code that processes the forwarded request, the
getQueryString() method does not return the query string.  However, the
parameters _are_ available via getParameter().

Section 8.1.1 of the Servlet 2.2 spec does not explicitly state what the
getQueryString() method should return in the event of a forward, but it
seems to me that if the new request parameters are added to the
request's internal list of parameters, that it only makes sense to also
add the parameters to the query string.

Section 8.4 of the spec states that "the path elements of the request
object reflect those of the original request."  Although a query string
is not strictly considered a "path element" according to the spec, it
does seem in the spirit of section 8.4 that the additional parameters
should be on the query string.

Does anyone have any thoughts on this?

Thanks,
Andrew



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: RequestDispatcher.forward() problem

2001-02-21 Thread paul marshal

Andrew Kerr wrote:
> 
> Hello,
> 
> I've been having a bit of trouble with the RequestDispatcher.forward()
> method.  If I try to forward to a URL with a query string on it, and
> then have some code that processes the forwarded request, the
> getQueryString() method does not return the query string.  However, the
> parameters _are_ available via getParameter().
> 
> Section 8.1.1 of the Servlet 2.2 spec does not explicitly state what the
> getQueryString() method should return in the event of a forward, but it
> seems to me that if the new request parameters are added to the
> request's internal list of parameters, that it only makes sense to also
> add the parameters to the query string.
> 
> Section 8.4 of the spec states that "the path elements of the request
> object reflect those of the original request."  Although a query string
> is not strictly considered a "path element" according to the spec, it
> does seem in the spirit of section 8.4 that the additional parameters
> should be on the query string.
> 
> Does anyone have any thoughts on this?
> 
> Thanks,
> Andrew

Hi !

I can't answer your exact question. 
But for many purposes - other than reusing an existing servlet class
that you forward to - 

request.setAttribute("name" , valueObject) ; 
RequestDispatcher dest = context.getRequestDispatcher("..."); 
dest.forward(request,response); 

will do. 

-- 
Paul Marshall
[EMAIL PROTECTED]
089/26019-609

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: RequestDispatcher.forward() in Tomcat 3.2.1

2001-02-16 Thread CPC Livelink Admin


What Craig meant (I believe) by "prohibits you from modifying the response"
is that the response has been committed and no more data can be sent. The
html/other-data you are sending to the client is part of the response. When
the forward returns, you are prohibited by the spec, from adding any more
information to the response output stream.

If you need to do as you desire, you must use some kind of include based
scheme instead of forward.

Regards,
Paul


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 16, 2001 9:38 AM
To: [EMAIL PROTECTED]
Subject: Re: RequestDispatcher.forward() in Tomcat 3.2.1


You are right.  Control does return to the calling servlet.  It just
couldn't
write to the response.  It would be nice if an exception was thrown.

After control returns to the calling servlet, I try forwarding to a second
servlet and that doesn't seem to work.  The first servlet that was forwarded
to did not change the response.

Is multiple forward within a servlet not supported/allowed?

Bill

"Craig R. McClanahan" wrote:

> William Au wrote:
>
> > Is there any way in Tomcat 3.2.1 for the control to return to a servlet
> > after its
> > call to RequestDispatcher.forward() is completed?
>
> Control *does* return -- RequestDispatcher.forward() is a normal Java
> method call.
>
> However, the servlet spec prohibits you from modifying the response at
this
> point.  If Weblogic lets you do this (for instance, by allowing you to add
> additional text to the response created by the forwarded-to servlet), then
> it is not obeying the spec.
>
> >  That is the behavior
> > of
> > WebLogic 5.1.0.  I want my code to work on the same way running under
> > both.   I am aware of the RequestDispatcher.include() method.
> >
> > Bill
> >
>
> Craig McClanahan
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: RequestDispatcher.forward() in Tomcat 3.2.1

2001-02-16 Thread William Au

You are right.  Control does return to the calling servlet.  It just couldn't
write to the response.  It would be nice if an exception was thrown.

After control returns to the calling servlet, I try forwarding to a second
servlet and that doesn't seem to work.  The first servlet that was forwarded
to did not change the response.

Is multiple forward within a servlet not supported/allowed?

Bill

"Craig R. McClanahan" wrote:

> William Au wrote:
>
> > Is there any way in Tomcat 3.2.1 for the control to return to a servlet
> > after its
> > call to RequestDispatcher.forward() is completed?
>
> Control *does* return -- RequestDispatcher.forward() is a normal Java
> method call.
>
> However, the servlet spec prohibits you from modifying the response at this
> point.  If Weblogic lets you do this (for instance, by allowing you to add
> additional text to the response created by the forwarded-to servlet), then
> it is not obeying the spec.
>
> >  That is the behavior
> > of
> > WebLogic 5.1.0.  I want my code to work on the same way running under
> > both.   I am aware of the RequestDispatcher.include() method.
> >
> > Bill
> >
>
> Craig McClanahan
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: RequestDispatcher.forward() in Tomcat 3.2.1

2001-02-15 Thread Casey Lucas


I believe this is the normal behavior.  Your servlet should
regain control after the forward.  At least I know it works
when forwarding to JSPs.

-Casey

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 3:15 PM
To: [EMAIL PROTECTED]
Subject: RequestDispatcher.forward() in Tomcat 3.2.1


Is there any way in Tomcat 3.2.1 for the control to return to a servlet
after its
call to RequestDispatcher.forward() is completed?  That is the behavior
of
WebLogic 5.1.0.  I want my code to work on the same way running under
both.   I am aware of the RequestDispatcher.include() method.


Bill


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]


-
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: RequestDispatcher.forward() in Tomcat 3.2.1

2001-02-15 Thread Craig R. McClanahan

William Au wrote:

> Is there any way in Tomcat 3.2.1 for the control to return to a servlet
> after its
> call to RequestDispatcher.forward() is completed?

Control *does* return -- RequestDispatcher.forward() is a normal Java
method call.

However, the servlet spec prohibits you from modifying the response at this
point.  If Weblogic lets you do this (for instance, by allowing you to add
additional text to the response created by the forwarded-to servlet), then
it is not obeying the spec.

>  That is the behavior
> of
> WebLogic 5.1.0.  I want my code to work on the same way running under
> both.   I am aware of the RequestDispatcher.include() method.
>
> Bill
>

Craig McClanahan




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RequestDispatcher.forward() in Tomcat 3.2.1

2001-02-15 Thread William Au

Is there any way in Tomcat 3.2.1 for the control to return to a servlet
after its
call to RequestDispatcher.forward() is completed?  That is the behavior
of
WebLogic 5.1.0.  I want my code to work on the same way running under
both.   I am aware of the RequestDispatcher.include() method.


Bill


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RequestDispatcher.include vs RequestDispatcher.forward(am I doing this the correct way???)

2001-01-23 Thread Randy Paries

I will try to be brief, but this will need to explanation.
1) I was going to search the archives , but the search engine is down, so
   please don't flame to bad.

I have jsps, that refer to database objects that have been populated by a
servlet and then forwarded to the jsp.

Looking at the code below, if a did a forward of the jspURL, it do not know
of the
UNservlet.consultant session object.

If I do the include, the jsp does know about the UNservlet.consultant
object.

The problem is that this only works with IE. Netscape, displays the html
generated in text(like view source)

I hope this makes sense. Can someone please Help???

Thanks

--snippet
HttpSession session = req.getSession(true);
session.putValue("UNservlet.consultant", new Consultant() );

RequestDispatcher disp =
getServletConfig().getServletContext().getRequestDispatcher(jspURL);

//the forward did not include the new session object
//disp.forward(req,res);

disp.include(req,res);


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RequestDispatcher.include vs RequestDispatcher.forward(am I doing this the correct way???)

2001-01-22 Thread Randy Paries

I will try to be brief, but this will need to explanation.
1) I was going to search the archives , but the search engine is down, so
   please don't flame to bad.

I have jsps, that refer to database objects that have been populated by a
servlet and then forwarded to the jsp.

Looking at the code below, if a did a forward of the jspURL, it do not know
of the
UNservlet.consultant session object.

If I do the include, the jsp does know about the UNservlet.consultant
object.

The problem is that this only works with IE. Netscape, displays the html
generated in text(like view source)

I hope this makes sense. Can someone please Help???

Thanks

--snippet
HttpSession session = req.getSession(true);
session.putValue("UNservlet.consultant", new Consultant() );

RequestDispatcher disp =
getServletConfig().getServletContext().getRequestDispatcher(jspURL);

//the forward did not include the new session object
//disp.forward(req,res);

disp.include(req,res);


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Is their a bug in Tomcat with the RequestDispatcher.forward(u rl) method?

2000-12-07 Thread Kurt Bernhard Pruenner

Quenten Van Egeren wrote:
> Thanks for the replies, I knew that the forward did an
> internal redirect, I was just confused as to why
> Weblogic was doing it one way and Tomcat another.
> 
> So the next question is :
> what is the easiest way to do  something like a
> response.sendRedirect() and still keep the request
> object intact?

Frankly, there isn't - response.sendRedirect instructs the browser to start a
new request and get a different page, so it works as if you were opening a new
browser window and loading that page; only session objects will live long
enough to get to that new page intact...

-- 
Kurt Bernhard Pruenner --- Haendelstrasse 17 --- 4020 Linz --- Austria
Music: http://www.mp3.com/Leak --- Work: http://www.ssw.uni-linz.ac.at
...It might be written "Mindfuck", but it's spelt "L-A-I-N"...
np: Boards Of Canada - XYZ (Peel Session broadcast)



RE: Is their a bug in Tomcat with the RequestDispatcher.forward(u rl) method?

2000-12-07 Thread Quenten Van Egeren

Thanks for the replies, I knew that the forward did an
internal redirect, I was just confused as to why
Weblogic was doing it one way and Tomcat another.

So the next question is : 
what is the easiest way to do  something like a
response.sendRedirect() and still keep the request
object intact?

Thanks,

Quenten
--- "MacLaren, Donald" <[EMAIL PROTECTED]> wrote:
> That's how it works
> 
> 
> -Original Message-
> From: David Rees [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 06, 2000 5:13 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Is their a bug in Tomcat with the
> RequestDispatcher.forward(url) method?
> 
> 
> A forward is an internal redirect, the client never
> sees it (and therefore
> never updates the URL in the status bar of the
> browser).
> 
> Tomcat is working properly, and it sounds like
> Weblogic is doing a redirect
> and is broken.
> 
> -Dave
> 
> > -Original Message-
> > From: Quenten Van Egeren
> [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, December 06, 2000 1:18 PM
> > To: [EMAIL PROTECTED]
> > Subject: Is their a bug in Tomcat with the
> > RequestDispatcher.forward(url) method?
> >
> >
> > I am using the following code snippet in one of my
> > servlets :
> >
> >   RequestDispatcher dispatcher =
> > request.getRequestDispatcher(url);
> >   dispatcher.forward(request, response);
> >
> > When I do this type of thing under Weblogic 5.1,
> the
> > url page is displayed and the url in the
> "Location"
> > box on the browser is changed to this url (this is
> > working correctly)
> >
> > When I do this under Apache/Tomcat the url page
> > displays correctly, but the url in the Location
> box is
> > the url of the previous page...
> >
> > Is there something special that I need to setup in
> one
> > of the Tomcat config files, or is this a bug?
> >
> > Any help would be greatly appreciated.
> >
> > Thanks in advance,
> >
> > Quenten Van Egeren
> > ([EMAIL PROTECTED])
> >
> > __
> > Do You Yahoo!?
> > Yahoo! Shopping - Thousands of Stores. Millions of
> Products.
> > http://shopping.yahoo.com/


__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/



RE: Is their a bug in Tomcat with the RequestDispatcher.forward(url) method?

2000-12-07 Thread MacLaren, Donald

That's how it works


-Original Message-
From: David Rees [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 06, 2000 5:13 PM
To: [EMAIL PROTECTED]
Subject: RE: Is their a bug in Tomcat with the
RequestDispatcher.forward(url) method?


A forward is an internal redirect, the client never sees it (and therefore
never updates the URL in the status bar of the browser).

Tomcat is working properly, and it sounds like Weblogic is doing a redirect
and is broken.

-Dave

> -Original Message-
> From: Quenten Van Egeren [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 06, 2000 1:18 PM
> To: [EMAIL PROTECTED]
> Subject: Is their a bug in Tomcat with the
> RequestDispatcher.forward(url) method?
>
>
> I am using the following code snippet in one of my
> servlets :
>
>   RequestDispatcher dispatcher =
> request.getRequestDispatcher(url);
>   dispatcher.forward(request, response);
>
> When I do this type of thing under Weblogic 5.1, the
> url page is displayed and the url in the "Location"
> box on the browser is changed to this url (this is
> working correctly)
>
> When I do this under Apache/Tomcat the url page
> displays correctly, but the url in the Location box is
> the url of the previous page...
>
> Is there something special that I need to setup in one
> of the Tomcat config files, or is this a bug?
>
> Any help would be greatly appreciated.
>
> Thanks in advance,
>
> Quenten Van Egeren
> ([EMAIL PROTECTED])
>
> __
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/



Re: Is their a bug in Tomcat with the RequestDispatcher.forward(url) method?

2000-12-06 Thread Shireesh Thanneru


I used WebLogic 5.1 SP6 for my last project and never experienced such behavior.
Whenever I forwarded to a target url, the target url never appeared in the
browser location box, it was always the previous url that the browser shows,
because that was the url that the browser has actually requested, and it has 
absolutely no knowledge of what you are doing on the server-side in this case,
do not confuse RequestDispatcher.forward() with response.sendRedirect().

Shireesh Thanneru

On Wed, 6 Dec 2000, Quenten Van Egeren wrote:

>I am using the following code snippet in one of my
>servlets :
>
>  RequestDispatcher dispatcher =
>request.getRequestDispatcher(url);
>  dispatcher.forward(request, response);
>
>When I do this type of thing under Weblogic 5.1, the
>url page is displayed and the url in the "Location"
>box on the browser is changed to this url (this is
>working correctly)
>
>When I do this under Apache/Tomcat the url page
>displays correctly, but the url in the Location box is
>the url of the previous page...
>
>Is there something special that I need to setup in one
>of the Tomcat config files, or is this a bug?
>
>Any help would be greatly appreciated.
>
>Thanks in advance,
>
>Quenten Van Egeren
>([EMAIL PROTECTED])
>
>__
>Do You Yahoo!?
>Yahoo! Shopping - Thousands of Stores. Millions of Products.
>http://shopping.yahoo.com/
>




RE: Is their a bug in Tomcat with the RequestDispatcher.forward(url) method?

2000-12-06 Thread David Rees

A forward is an internal redirect, the client never sees it (and therefore
never updates the URL in the status bar of the browser).

Tomcat is working properly, and it sounds like Weblogic is doing a redirect
and is broken.

-Dave

> -Original Message-
> From: Quenten Van Egeren [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 06, 2000 1:18 PM
> To: [EMAIL PROTECTED]
> Subject: Is their a bug in Tomcat with the
> RequestDispatcher.forward(url) method?
>
>
> I am using the following code snippet in one of my
> servlets :
>
>   RequestDispatcher dispatcher =
> request.getRequestDispatcher(url);
>   dispatcher.forward(request, response);
>
> When I do this type of thing under Weblogic 5.1, the
> url page is displayed and the url in the "Location"
> box on the browser is changed to this url (this is
> working correctly)
>
> When I do this under Apache/Tomcat the url page
> displays correctly, but the url in the Location box is
> the url of the previous page...
>
> Is there something special that I need to setup in one
> of the Tomcat config files, or is this a bug?
>
> Any help would be greatly appreciated.
>
> Thanks in advance,
>
> Quenten Van Egeren
> ([EMAIL PROTECTED])
>
> __
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/




Is their a bug in Tomcat with the RequestDispatcher.forward(url) method?

2000-12-06 Thread Quenten Van Egeren

I am using the following code snippet in one of my
servlets :

  RequestDispatcher dispatcher =
request.getRequestDispatcher(url);
  dispatcher.forward(request, response);

When I do this type of thing under Weblogic 5.1, the
url page is displayed and the url in the "Location"
box on the browser is changed to this url (this is
working correctly)

When I do this under Apache/Tomcat the url page
displays correctly, but the url in the Location box is
the url of the previous page...

Is there something special that I need to setup in one
of the Tomcat config files, or is this a bug?

Any help would be greatly appreciated.

Thanks in advance,

Quenten Van Egeren
([EMAIL PROTECTED])

__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/



RE: question about RequestDispatcher.forward() in tomcat

2000-11-14 Thread Kedar Choudary

Following code will do the job
-
import javax.servlet.*;
import javax.servlet.http.*;

import java.io.*;
import java.util.*;

public class Controller extends HttpServlet {
public void service(ServletRequest req, ServletResponse res) throws
ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("This is from Contrller\n");
out.flush();

ServletContext ctx = getServletContext();
RequestDispatcher rd = ctx.getNamedDispatcher("jsp");
rd.include(req, res);
}
}
---

-Original Message-
From: Lacerda, Wellington (AFIS) [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 13, 2000 4:03 PM
To: '[EMAIL PROTECTED]'
Subject: RE: question about RequestDispatcher.forward() in tomcat


I wrote a small MVC framework and I have my controller mapped to a common
name like "dispatch.htm" and I send all requests directly to it, with a
parameter specifying the action. So, all the requests are always like:

do something

It's working fairly well.

Wellington Silva
UN/FAO

-Original Message-
From: Chen, Kevin [mailto:[EMAIL PROTECTED]]
Sent: 09 November 2000 00:32
To: '[EMAIL PROTECTED]'
Subject: question about RequestDispatcher.forward() in tomcat


I am trying to implement a MVC system. the controller
will intercept all request for .jsp page, then forward
it to the jsp page after some checking.

I am using TOMCAT to run the servlet. and using
extension rul mapping, i.e.:(in web.xml)

 controller 
 *.jsp 

My test controller just forward the page to another jsp page,
the code looks like:
RequestDispatcher dis;
dis=getServletContext().getRequestDispatcher("/index.jsp");
dis.forward (req, res);
//dis.include (req, res);

the problem with above approach is that, my controller will
intercept the index.jsp too. which will cause the page cannot
be displayed. looks like the servlet container resend the
index.jsp page to me again and again.


Is there anyway around it?

Appreciate any help.
kevin




RE: question about RequestDispatcher.forward() in tomcat

2000-11-13 Thread Lacerda, Wellington (AFIS)

I wrote a small MVC framework and I have my controller mapped to a common
name like "dispatch.htm" and I send all requests directly to it, with a
parameter specifying the action. So, all the requests are always like:

do something

It's working fairly well.

Wellington Silva
UN/FAO

-Original Message-
From: Chen, Kevin [mailto:[EMAIL PROTECTED]]
Sent: 09 November 2000 00:32
To: '[EMAIL PROTECTED]'
Subject: question about RequestDispatcher.forward() in tomcat


I am trying to implement a MVC system. the controller
will intercept all request for .jsp page, then forward
it to the jsp page after some checking.

I am using TOMCAT to run the servlet. and using
extension rul mapping, i.e.:(in web.xml)

 controller 
 *.jsp 

My test controller just forward the page to another jsp page,
the code looks like:
RequestDispatcher dis;
dis=getServletContext().getRequestDispatcher("/index.jsp");
dis.forward (req, res);
//dis.include (req, res);

the problem with above approach is that, my controller will
intercept the index.jsp too. which will cause the page cannot
be displayed. looks like the servlet container resend the
index.jsp page to me again and again.


Is there anyway around it?

Appreciate any help.
kevin



RE: question about RequestDispatcher.forward() in tomcat

2000-11-09 Thread Chen, Kevin

thanks, that helped.

Actually you do not need to map each url to a jsp page. you can use
path mapping, then when you forward to jsp page, get rid of the servelet
path. that will simply your configuration a lot.

cheers,

kevin

-Original Message-
From: Byung Jin Chun [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 09, 2000 9:32 AM
To: '[EMAIL PROTECTED]'
Subject: RE: question about RequestDispatcher.forward() in tomcat


Kevin,
   many moons ago and before struts, we implemented something
that looks similar to what you are seeking. We mapped a uri(no extensions)
that went to the controller. In the jsps that are called from the
controller,
the jsp checks an object set in the request by the controller to make sure
there wasn't any bypassing.

Jin

-Original Message-
From: Chen, Kevin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 09, 2000 10:20 AM
To: '[EMAIL PROTECTED]'
Subject: RE: question about RequestDispatcher.forward() in tomcat


I want to centralized security check for each jsp page(not only
action) in our controller. If I map the jsp page to an logical
name, user may still be able to bypass the security check by going
to the jsp page directly.

Another goal is to maintain common look and feel. I do not want
each jsp page developer to include template.jsp. I want it be
enforced by the controller. So that jsp page developer can concentrate
on their task only.

The implementation of RequestDispatcher.forward()/include() does not
looks right to me. I mean if the jsp page comes from my controller,
it should not go back to it again. Is this a bug?

Thanks,

kevin

-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 08, 2000 6:30 PM
To: [EMAIL PROTECTED]
Subject: Re: question about RequestDispatcher.forward() in tomcat


What I do in the Struts framework <http://jakarta.apache.org/struts>,
which implements the MVC pattern you are talking about, is map a
different extension for the logical actions (normally, these will be the
values you use for hyperlinks and form submits).  I like to use "*.do"
because it implies "go do something".

That way, I leave the mappings for the JSP pages set to the JSP servlet,
as it normally is.

Craig McClanahan


"Chen, Kevin" wrote:

> I am trying to implement a MVC system. the controller
> will intercept all request for .jsp page, then forward
> it to the jsp page after some checking.
>
> I am using TOMCAT to run the servlet. and using
> extension rul mapping, i.e.:(in web.xml)
> 
>  controller 
>  *.jsp 
> 
> My test controller just forward the page to another jsp page,
> the code looks like:
> RequestDispatcher dis;
> dis=getServletContext().getRequestDispatcher("/index.jsp");
> dis.forward (req, res);
> //dis.include (req, res);
>
> the problem with above approach is that, my controller will
> intercept the index.jsp too. which will cause the page cannot
> be displayed. looks like the servlet container resend the
> index.jsp page to me again and again.
>
> Is there anyway around it?
>
> Appreciate any help.
> kevin



RE: question about RequestDispatcher.forward() in tomcat

2000-11-09 Thread Byung Jin Chun

Kevin,
   many moons ago and before struts, we implemented something
that looks similar to what you are seeking. We mapped a uri(no extensions)
that went to the controller. In the jsps that are called from the
controller,
the jsp checks an object set in the request by the controller to make sure
there wasn't any bypassing.

Jin

-Original Message-
From: Chen, Kevin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 09, 2000 10:20 AM
To: '[EMAIL PROTECTED]'
Subject: RE: question about RequestDispatcher.forward() in tomcat


I want to centralized security check for each jsp page(not only
action) in our controller. If I map the jsp page to an logical
name, user may still be able to bypass the security check by going
to the jsp page directly.

Another goal is to maintain common look and feel. I do not want
each jsp page developer to include template.jsp. I want it be
enforced by the controller. So that jsp page developer can concentrate
on their task only.

The implementation of RequestDispatcher.forward()/include() does not
looks right to me. I mean if the jsp page comes from my controller,
it should not go back to it again. Is this a bug?

Thanks,

kevin

-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 08, 2000 6:30 PM
To: [EMAIL PROTECTED]
Subject: Re: question about RequestDispatcher.forward() in tomcat


What I do in the Struts framework <http://jakarta.apache.org/struts>,
which implements the MVC pattern you are talking about, is map a
different extension for the logical actions (normally, these will be the
values you use for hyperlinks and form submits).  I like to use "*.do"
because it implies "go do something".

That way, I leave the mappings for the JSP pages set to the JSP servlet,
as it normally is.

Craig McClanahan


"Chen, Kevin" wrote:

> I am trying to implement a MVC system. the controller
> will intercept all request for .jsp page, then forward
> it to the jsp page after some checking.
>
> I am using TOMCAT to run the servlet. and using
> extension rul mapping, i.e.:(in web.xml)
> 
>  controller 
>  *.jsp 
> 
> My test controller just forward the page to another jsp page,
> the code looks like:
> RequestDispatcher dis;
> dis=getServletContext().getRequestDispatcher("/index.jsp");
> dis.forward (req, res);
> //dis.include (req, res);
>
> the problem with above approach is that, my controller will
> intercept the index.jsp too. which will cause the page cannot
> be displayed. looks like the servlet container resend the
> index.jsp page to me again and again.
>
> Is there anyway around it?
>
> Appreciate any help.
> kevin



RE: question about RequestDispatcher.forward() in tomcat

2000-11-09 Thread Chen, Kevin

I want to centralized security check for each jsp page(not only
action) in our controller. If I map the jsp page to an logical
name, user may still be able to bypass the security check by going
to the jsp page directly.

Another goal is to maintain common look and feel. I do not want
each jsp page developer to include template.jsp. I want it be
enforced by the controller. So that jsp page developer can concentrate
on their task only.

The implementation of RequestDispatcher.forward()/include() does not
looks right to me. I mean if the jsp page comes from my controller,
it should not go back to it again. Is this a bug?

Thanks,

kevin

-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 08, 2000 6:30 PM
To: [EMAIL PROTECTED]
Subject: Re: question about RequestDispatcher.forward() in tomcat


What I do in the Struts framework <http://jakarta.apache.org/struts>,
which implements the MVC pattern you are talking about, is map a
different extension for the logical actions (normally, these will be the
values you use for hyperlinks and form submits).  I like to use "*.do"
because it implies "go do something".

That way, I leave the mappings for the JSP pages set to the JSP servlet,
as it normally is.

Craig McClanahan


"Chen, Kevin" wrote:

> I am trying to implement a MVC system. the controller
> will intercept all request for .jsp page, then forward
> it to the jsp page after some checking.
>
> I am using TOMCAT to run the servlet. and using
> extension rul mapping, i.e.:(in web.xml)
> 
>  controller 
>  *.jsp 
> 
> My test controller just forward the page to another jsp page,
> the code looks like:
> RequestDispatcher dis;
> dis=getServletContext().getRequestDispatcher("/index.jsp");
> dis.forward (req, res);
> //dis.include (req, res);
>
> the problem with above approach is that, my controller will
> intercept the index.jsp too. which will cause the page cannot
> be displayed. looks like the servlet container resend the
> index.jsp page to me again and again.
>
> Is there anyway around it?
>
> Appreciate any help.
> kevin



Re: question about RequestDispatcher.forward() in tomcat

2000-11-08 Thread Craig R. McClanahan

What I do in the Struts framework ,
which implements the MVC pattern you are talking about, is map a
different extension for the logical actions (normally, these will be the
values you use for hyperlinks and form submits).  I like to use "*.do"
because it implies "go do something".

That way, I leave the mappings for the JSP pages set to the JSP servlet,
as it normally is.

Craig McClanahan


"Chen, Kevin" wrote:

> I am trying to implement a MVC system. the controller
> will intercept all request for .jsp page, then forward
> it to the jsp page after some checking.
>
> I am using TOMCAT to run the servlet. and using
> extension rul mapping, i.e.:(in web.xml)
> 
>  controller 
>  *.jsp 
> 
> My test controller just forward the page to another jsp page,
> the code looks like:
> RequestDispatcher dis;
> dis=getServletContext().getRequestDispatcher("/index.jsp");
> dis.forward (req, res);
> //dis.include (req, res);
>
> the problem with above approach is that, my controller will
> intercept the index.jsp too. which will cause the page cannot
> be displayed. looks like the servlet container resend the
> index.jsp page to me again and again.
>
> Is there anyway around it?
>
> Appreciate any help.
> kevin




question about RequestDispatcher.forward() in tomcat

2000-11-08 Thread Chen, Kevin

I am trying to implement a MVC system. the controller
will intercept all request for .jsp page, then forward
it to the jsp page after some checking.

I am using TOMCAT to run the servlet. and using
extension rul mapping, i.e.:(in web.xml)

 controller 
 *.jsp 

My test controller just forward the page to another jsp page,
the code looks like:
RequestDispatcher dis;
dis=getServletContext().getRequestDispatcher("/index.jsp");
dis.forward (req, res);
//dis.include (req, res);

the problem with above approach is that, my controller will
intercept the index.jsp too. which will cause the page cannot
be displayed. looks like the servlet container resend the
index.jsp page to me again and again.


Is there anyway around it?

Appreciate any help.
kevin