所以这就是问题所在:
example.com:8080/txt/temp.txt
结果如下:
ÑÑ,оновÑ<йѓайл这是一个新文件
我尝试了什么:
的glassfish-web.xml中
<glassfish-web-app>
<parameter-encoding default-charset="UTF-8"/>
</glassfish-web-app>
的web.xml
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>
org.apache.catalina.servlets.DefaultServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>fileEncoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
在domain / config / default-web.xml中添加到默认servlet
<init-param>
<param-name>fileEncoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
在glassfish4 / bin / asadmin中在-jar之后添加
-Dfile.encoding = UTF-8
没有结果。请帮帮我。