风之力

BlogJava 首页 新随笔 联系 聚合 管理
  19 Posts :: 2 Stories :: 18 Comments :: 0 Trackbacks
新建一个SetCharacterEncodingServlet的类(继承ActionServlet),重写process()方法。如下示:
          protected void process(HttpServletRequest request,
            HttpServletResponse response) throws java.io.IOException,
            javax.servlet.ServletException
          {
                request.setCharacterEncoding("UTF-8");
              super.process(request, response);
            }
在web.xml中部署ActionServlet。
<servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>com..util.UTF8ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
     <init-param>
      <param-name>debug</param-name>
      <param-value>3</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>3</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
  </servlet>

   <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
   </servlet-mapping>
posted on 2006-09-13 10:51 风之力 阅读(490) 评论(0)  编辑  收藏 所属分类: java

只有注册用户登录后才能发表评论。


网站导航: