Title: RE: Difference between html meta tag and jsp page directive

Great. I wasn't aware of the setContentType method. If I take this approach, would it cause
problems if I remove all characterset info,using the page directive, from my jsp
pages and instead insert a bean, which sole function is to call the setContentType
based on data from a configuration file.

/Peter


-----Original Message-----
From: Joe Cheng [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 11, 2002 10:56 AM
To: [EMAIL PROTECTED]
Subject: Re: Difference between html meta tag and jsp page directive


It's probably safer to do the page directive rather than meta tag.  If you
look at the generated .java file, you'll see that the content type header
gets set before your JSP code even starts executing.  In my installation of
Tomcat 3.2.4 it's this line:

  response.setContentType("text/html;charset=ISO-8859-1");

So if you're later overwriting it with another value, either using
response.setContentType() again or using the meta tag, who knows how the
browser will interpret it.  (I suspect the server won't even let you call
response.setContentType() after you've written anything to the output
stream.)

Maybe you can first use a servlet to intercept the request, set the content
type dynamically, and then forward the request on to your JSP?  Hmmm.

-jmc

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to