Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 15263 invoked from network); 12 Dec 2001 18:00:48 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 12 Dec 2001 18:00:48 -0000 Received: (qmail 1664 invoked by uid 97); 12 Dec 2001 18:00:19 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 1648 invoked by uid 97); 12 Dec 2001 18:00:18 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 1637 invoked from network); 12 Dec 2001 18:00:17 -0000 Date: Wed, 12 Dec 2001 10:00:14 -0800 (PST) From: "Craig R. McClanahan" Sender: craigmcc@localhost To: Tomcat Users List Subject: Re: RE2: Jsp compile option for Big5 encoding / encoding question In-Reply-To: <010001c17bd6$54371b80$48976c84@ses.sk> Message-ID: <20011212095804.H11360-100000@localhost> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: localhost 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Mon, 3 Dec 2001, Ing. Gabriel Gajdos wrote: > Date: Mon, 3 Dec 2001 09:41:39 +0100 > From: Ing. Gabriel Gajdos > Reply-To: Tomcat Users List > To: tomcat-user@jakarta.apache.org > Subject: RE2: Jsp compile option for Big5 encoding / encoding question > > Craig (or somebody else), could you, please, give me a hint in following question? > > | JSP pages follow these rules: > | > | * If you declare a "pageEncoding" attribute on your <%@ page %> > | directive (supported in JSP 1.2 only), that character set is used > | to read the text of the page itself (as the page is being compiled). > | > | * The character encoding from the contentType attribute of the > | <%@ page %> directive is used, if present > > I know and use these settings... > But: > Is it possible to have SINGLE JSP page with *variable* encoding/Content Type? > > <%@ page contentType="text/html; charset=XY" %> > > And I want to set the Content Type (or charset/encoding) according to *current* conditions. > For example acording to a field value from database, or Property from .properties file with language dependent settings. > > Is this possible in T4? IMHO JSP specifications do not say about this. > > I would like to make something similar (this syntax is NOT correct): > > <%@ page contentType="p.getProperty("ContentType")" %> > > I also tried a custom tag solution, but with no success. > It seams, directives bitween <%@ %> directives can not contain executable code. > > Of course, this approach works when using servlet (I mean variable ContentType). > So can this also be done in JSPs? > Or in this case is the only way to do it by using Unicode? > > Thanx in advance. > In JSP 1.1 you cannot reliably do this. In JSP 1.2, the container is required to allow you to set the content type and character encoding dynamically, either like this: <% String contentType = "text/html;charset=Big5"; // Or whatever response.setContentType(contentType); %> or by having a custom tag do this for you. The only restriction is that you have to set this before the output buffer is flushed. > GG > Craig -- To unsubscribe: For additional commands: Troubles with the list: