A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Java
»
JSF
Author
custom component and character encoding
Skopin Anton
Greenhorn
Joined: Apr 06, 2005
Posts: 2
posted
Apr 06, 2005 03:15:00
0
Hello
I write my own component that represent a tree.
But I have a question.
If i write in jsp page a tag
<h
utputText value="main page"/>
where text "main page" in other language (Russian)
JSF
will output next html code
& # 1 0 4 3 ; & # 1 0 8 3 ; & # 1 0 7 2 ; & # 1 0 7 4 ; & # 1 0 8 5 ; & # 1 0 7 2 ; & # 1 1 0 3 ; & # 1 0 8 9 ; & # 1 0 9 0 ; & # 1 0 8 8 ; & # 1 0 7 2 ; & # 1 0 8 5 ; & # 1 0 8 0 ; & # 1 0 9 4 ; & # 1 0 7 2 ;
(in code i put a space char between all char`s)
I create my component, tag and renderer.
In renderer I create html code for tree
String htmlTree=createTree(Tree).getHtml(); context.getResponseWriter().writeText(htmlTree,"")
or
writer.write(new String(htmlTree.getBytes(),writer.getCharacterEncoding()));
where WRITER is a context.getResponseWriter();
In html code that create a component is
not exactly what I want see (see above ).
i.e. that writer not decode russain symbols.
How correct this??
JSF 1.1
jboss
3.2.3
tomcat
4
p.s. sorry for bad english
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1400
posted
Apr 06, 2005 11:05:00
0
Is this problem coming with your custom component.
Are the other regular JSF components displaying data properly?
- Varun
Skopin Anton
Greenhorn
Joined: Apr 06, 2005
Posts: 2
posted
Apr 07, 2005 00:22:00
0
Hello Varun
Other standart component are displaying data propertly.
And other my custom component also ok.
In other my component i use next code:
(my buttons)
writer.startElement("input", sb); writer.writeAttribute("type", "submit", null); writer.writeAttribute("name", sb.getId()+"r", "id"); writer.writeAttribute("value", "Russian text",null); writer.writeAttribute("onclick",getSubmitScript(getPName(context, sb),sb,"a1",context),null); writer.endElement("input");
and russian text in this button is ok adn look like
& # 1 0 4 9 ; & # 1 0 5 6 .......
[ April 07, 2005: Message edited by: Skopin Anton ]
I agree. Here's the link:
http://aspose.com/file-tools
subject: custom component and character encoding
Similar Threads
struct in java
Custom JSF Tag & Facelets
Exception -- java.lang.StackOverflowError
Something i'm extremely confused on
Game Programming Problem! J2ME
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter