b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

tomcat5.0下载 [转载]Tomcat配置(6)

电脑杂谈  发布时间:2017-01-23 15:12:58  来源:网络整理

</mime-mapping>

<mime-mapping>

<extension>html</extension>

<mime-type>text/html;charset=gb2312</mime-type>

</mime-mapping>

</web-app>

11.添加welcome-file-list,并调整顺序。

<welcome-file-list>

<welcome-file>index.jsp</welcome-file>

<welcome-file>index.html</welcome-file>

<welcome-file>index.htm</welcome-file>

<welcome-file>default.html</welcome-file>

<welcome-file>default.htm</welcome-file>

<welcome-file>default.jsp</welcome-file>

</welcome-file-list>

Tomcat中文编码问题解决方案(简)

liyonghai 04/08/30

编码问题的根源可参考

Tomcat 4.x解决方法:

获取中文:request.setCharacterEncoding('gb2312');

输出中文:<%@ page contentType='text/html;charset=gb2312'%>,必要时需要转码

Tomcat 5.x解决方法:

获取中文:

提交表单时

1)post:request.setCharacterEncoding('gb2312');

2)get:修改server.xml,在Connector中加入URIEncoding='gb2312'

如: <Connector port='80' maxThreads='150' minSpareThreads='25'maxSpareThreads='75'

enableLookups='false' redirectPort='8443' acceptCount='100'

debug='0' connectionTimeout='20000'

disableUploadTimeout='true' URIEncoding='gb2312' />

或者使用useBodyEncodingForURI,使tomcat 5.x兼容tomcat 4.x

输出中文:<%@ page contentType='text/html;charset=gb2312'%>,必要时需要转码

附:Tomcat 5.x与Tomcat 4.x在解析提交表单时发生了变化,Tomcat4.x无论是post还是get,都使用

相同的编码,而Tomcat 5.x 却把get方法单独了出来.具体可查看tomcat的source code.

get方式的处理比较好,对于post方式建议用配置过滤器的方式来解决,因为这样,配置一个地方整个系统都不用操心了。

简单说明:

web.xml

<filter>

<filter-name>Set Character Encoding</filter-name>


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-28301-6.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...