I try to produce Chinese_Character(CC,for short) HTML page with servlet, some 
Chinese character string is directly denoted with a string in the java code, and the 
other is selected from database. I test two servlet server "JRUN" and "JavaWebServer" 
with different cases, the result is not as good as I wish, which is listed below:

(1)
The Server |   output          | CC(not from Database) | CC(from Database)
----------------------------------------------------------------------------
JRUN       | new PrintStream() |         OK            |         OK
JRUN       | getOutPutStream() |      (not use CC)     |        OK
JRUN       | getOutPutStream() | (when use CC, "500 Internal Server Error"  )
JWS        | new PrintStream() |         OK            |       not OK
JWS        | getOutPutStream() |       not OK          |        OK


"500 Internal Server Error" description is:
"TestDbServlet:
java.io.CharConversionException: Not an ISO 8859-1 character: "

note: "getOutPutStream" denotes directly writing to 
HttpServletResponse.getOutputStream():
"
        res.setContentType("text/html");
        ServletOutputStream out = res.getOutputStream();
        out.println ("<HTML><HEAD>");
        ...
        out.println (a CC string directly denoted by quotation marks "");
        ...
        (select a CC string from database)
        out.println ("the selected CC string");
        ...
        out.println ("</BODY></HTML>");
        out.close();
"

And "new PrintStream()" denotes buffered writing:
"
        ByteArrayOutputStream   bytes;
        PrintStream             out;
        bytes = new ByteArrayOutputStream (4096);
        out = new PrintStream (bytes);
        out.println ("<HTML><HEAD>");
        ...
        out.println (a CC string directly denoted by quotation marks "");
        ...
        (select a CC string from database)
        out.println ("the selected CC string");
        ...
        res.setContentType("text/html");
        res.setContentLength (bytes.size ());
        bytes.writeTo (res.getOutputStream ());
"

Question 1:
  Let's check the result from the test of JavaWebServer secondly, I found the CC 
string directly written to the html file, and the CC string written to the html file 
which is selected from the database, can not OK together.I don't know why.

The Server |   output          | CC(not from Database) | CC(from Database)
----------------------------------------------------------------------------
JWS        | new PrintStream() |         OK            |       not OK
JWS        | getOutPutStream() |       not OK          |        OK

Question 2:
  Why "500 Internal Server Error" occured when I used the two classes of CC string in 
a selevet supported by "JRUN"?
  I can not insert a CC string to the "HelloWorldServlet" example, so as to produce a 
html page contained CC string.

 I am afraid that I will develop chunks of uncompatible java code. Please help me.


--WangJun
[EMAIL PROTECTED]


__________________________________________________
��ӭʹ���׶�������ѵ�������http://freemail.263.net

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to