RE: RequestDispatcher and pageEncoding question...

2004-04-16 Thread Yansheng Lin
Hi, 

You are confused with request and response.  The request is shared by the
forwarding jsp and the forwarded jsp, not the response(well kind of, but not
until it's being generated).  You will have to explicitly set the response
contentType to utf-8 in the forwarded page.  

-Yan


-Original Message-
From: Timothy Stone [mailto:[EMAIL PROTECTED] 
Sent: April 15, 2004 14:45
To: Tomcat Users List
Cc: [EMAIL PROTECTED]
Subject: Re: RequestDispatcher and pageEncoding question...


Timothy Stone wrote:

 Timothy Stone wrote:
 
 List,

 A servlet I am debugging and trying to understand sets the response's 
 contentType as follows:

 response.setContentType( text/html;charset=UTF-8 );

 Shortly following the following forward is done:

 request.getRequestDispatcher( jspPage ).forward( request, response );
 response.getWriter().flush();

 The JSP forwarded gets the response with the contentType set, but 
 commiting the response seems to reset the contentType to 
 text/html;charset=ISO-8859-1, the default.

 The JSP in the forward does not set a pageEncoding attribute in the 
 page directive, so I'm pointing the finger there at the moment. Can 
 someone outline what is going on behind the scenes of the 
 requestDispatcher call that would be reseting the response's contentType?
 
 
  From the documentation:
 
 ...Uncommitted output in the response buffer is automatically cleared 
 before the forward.
 
 So, is the call to response.setContentType() being reset on the 
 forward()? Can anyone elaborate?

I see that nearly exactly what I'm experiencing was discussed last year 
regarding the behavior as seen through Struts. No resolution given.

http://marc.theaimsgroup.com/?l=tomcat-userm=106323343414285w=2

I'll continue to watch this new thread for suggestions.

Again, with many thanks,
Tim

-
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 and pageEncoding question...

2004-04-15 Thread Timothy Stone
Timothy Stone wrote:

List,

A servlet I am debugging and trying to understand sets the response's 
contentType as follows:

response.setContentType( text/html;charset=UTF-8 );

Shortly following the following forward is done:

request.getRequestDispatcher( jspPage ).forward( request, response );
response.getWriter().flush();
The JSP forwarded gets the response with the contentType set, but 
commiting the response seems to reset the contentType to 
text/html;charset=ISO-8859-1, the default.

The JSP in the forward does not set a pageEncoding attribute in the page 
directive, so I'm pointing the finger there at the moment. Can someone 
outline what is going on behind the scenes of the requestDispatcher call 
that would be reseting the response's contentType?
From the documentation:

...Uncommitted output in the response buffer is automatically cleared 
before the forward.

So, is the call to response.setContentType() being reset on the 
forward()? Can anyone elaborate?

Again,
Many thanks in advance,
Tim


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


Re: RequestDispatcher and pageEncoding question...

2004-04-15 Thread Timothy Stone
Timothy Stone wrote:

Timothy Stone wrote:

List,

A servlet I am debugging and trying to understand sets the response's 
contentType as follows:

response.setContentType( text/html;charset=UTF-8 );

Shortly following the following forward is done:

request.getRequestDispatcher( jspPage ).forward( request, response );
response.getWriter().flush();
The JSP forwarded gets the response with the contentType set, but 
commiting the response seems to reset the contentType to 
text/html;charset=ISO-8859-1, the default.

The JSP in the forward does not set a pageEncoding attribute in the 
page directive, so I'm pointing the finger there at the moment. Can 
someone outline what is going on behind the scenes of the 
requestDispatcher call that would be reseting the response's contentType?


 From the documentation:

...Uncommitted output in the response buffer is automatically cleared 
before the forward.

So, is the call to response.setContentType() being reset on the 
forward()? Can anyone elaborate?
I see that nearly exactly what I'm experiencing was discussed last year 
regarding the behavior as seen through Struts. No resolution given.

http://marc.theaimsgroup.com/?l=tomcat-userm=106323343414285w=2

I'll continue to watch this new thread for suggestions.

Again, with many thanks,
Tim
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]