+ -
当前位置:首页 → 问答吧 → freemarker生成的html乱码以及jsp-config的配置问题

freemarker生成的html乱码以及jsp-config的配置问题

时间:2011-06-21

来源:互联网

freemarker生成的html乱码以及jsp-config的配置问题






    今天用freemarker生成的html有乱码,我每一步都设置了编码(utf-8),但还是不管用,而且直接打开生成的html,没有乱码,但是服务器中打开有问题,所以断定是tomcat出的问题,所以俺在web.xml中配置如下:
     
Xml代码
  1. <jsp-config>
  2.                 <jsp-property-group>
  3.                         <description>html encoding</description>
  4.                         <display-name>JSPConfig</display-name>
  5.                         <url-pattern>/htmltemple/*</url-pattern>
  6.                         <el-ignored>true</el-ignored>
  7.                         <page-encoding>UTF-8</page-encoding>
  8.                         <scripting-invalid>
  9.                               false
  10.                             </scripting-invalid>
  11.                         <include-prelude></include-prelude>
  12.                         <include-coda></include-coda>
  13.                 </jsp-property-group>
  14.         </jsp-config>
  15.   
复制代码
解决乱码问题。但是,我发现居然自定义的几个tag居然没用了,后来果断把<taglib>配置到这个jsp-config下(以前是放在外面的),重启搞定。
    原来当有了这个jsp-config的时候,外面的taglib不起作用,晕!

作者: feiyang10086   发布时间: 2011-06-21

学习到了谢谢

作者: club34   发布时间: 2011-07-16