aspose file tools*
The moose likes Servlets and the fly likes Creating Multi Language Pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Creating Multi Language Pages" Watch "Creating Multi Language Pages" New topic
Author

Creating Multi Language Pages

Luke Shannon
Ranch Hand

Joined: Sep 30, 2004
Posts: 239
Hello;

Our site is moving to multi language.

All of our actions extand a base action. On that page I have added the following:

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

However when I look at the source of a generated html page I don't see a meta tag with the charset equal to UTF-8.

Before I start tracing the response object to see if the type is being over written what should I expect to see in the generated HTML when setting the type in this way?

Also does any one have any other tips/suggestions related to adding multi language support to an existing site (previously only english).

Thanks,

Luke


Luke
SCJP
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

Why on earth would you expect HTML to be magically generated? If you want some HTML to be on your page, you're going to need to put it there.
[ June 27, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Luke Shannon
Ranch Hand

Joined: Sep 30, 2004
Posts: 239
I am unclear about what calling response.setContentType("text/html; charset=UTF-8"); does. The documentation says:

Sets the content type of the response being sent to the client.

I was having trouble understanding how this was achieved (ie: How I can verify it is working).

I just found this blog posting, it works with JSP, but is doing something similar to what I want to do:

web page
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It does but not by generating a meta tag.

It sets the Content-Type HTTP header.
If you would like to see the headers being passed back and forth from server to client, download the LiveHTTPHeaders plugin for FireFox.

http://livehttpheaders.mozdev.org/


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

Originally posted by Luke Shannon:
I am unclear about what calling response.setContentType("text/html; charset=UTF-8");


Exactly as the docs say, it sets the content type and char set of the response being sent to the client so that the browser knows what type of file it is (an HTML page vs. an image, for example) and what the char set of the response body is.
Luke Shannon
Ranch Hand

Joined: Sep 30, 2004
Posts: 239
Thank you both. It is all clear now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating Multi Language Pages