Title: struts' behavior directly outputs Chinese remarks [Original]
终极管理员 知识笔记 116阅读
Just answered the question in the group about how to create an interactive fast dynamic web application. The Chinese page generated by the behavior got garbled, and he felt it necessary to write it down. This code is written like this, and the output code is UTF-8Response. Set the content type ('text/html; charset=utf-8 '); Response. Set the title ("Cache Control" and "No Cache"); Try {printwriter pw=newprintwriter (newoutputstreamwriter (response. Get the output stream (),' UTF-8'); pw。 Write (XML buf. tostring()); pw。 close(); } catch(Java。 io。 ioexceptione){ e . printstacktrace(); Put it here, it will be useful in the future.
标签: