[Tapestry5] Tapestry 5.0.6 中文问题.

newfire 2007-11-07
以下情况中文显示正常:
1.form 提交后,接收显示正常.
2.*.tml中直接包括的中文,显示正常.
3.数据库取出的字串中文显示正常.

不正常的情况.
1.*.java中直接输入或定义的.如:system.out.println("中文测试");


请问各位有没有发生过类似情况.

web.xml配置了:
<filter>
<filter-name>SetCharacterEncoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>


moonfly2004 2007-11-08
你的*.java文件的存储编码格式是utf-8吗?
foxgst 2007-11-15
(T5.0.6-SNAPSHOT)经验证,没有问题。
nazar 2007-11-17
我用form提交的中文在另一个页面显示出来是乱码,怎么解决?

谢谢!
tapestry 2007-11-19
参考 解决Form的提交乱码问题
http://tapestrying.group.iteye.com/group/blog/114705
nazar 2007-11-21
tapestry 写道
参考 解决Form的提交乱码问题
http://tapestrying.group.iteye.com/group/blog/114705


谢谢,直接用那个代码在5.0.6下不行,稍微改了一下就可以了。

----------------------------------------------------------------

    public RequestFilter buildUtf8Filter(final Logger log)
    {
        return new RequestFilter()
        {
            public boolean service(Request request, Response response, RequestHandler handler)
                    throws IOException
            {
                try
                {
                    // The reponsibility of a filter is to invoke the corresponding method
                    // in the handler. When you chain multiple filters together, each filter
                    // received a handler that is a bridge to the next filter.
                   
                request.setEncoding("UTF-8");
                    return handler.service(request, response);
                }
                finally
                {
                }
            }
        };
    }



    public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration,
            @InjectService("TimingFilter")
            RequestFilter timingFilter, @InjectService("Utf8Filter") RequestFilter utf8Filter)
    {
        // Each contribution to an ordered configuration has a name, When necessary, you may
        // set constraints to precisely control the invocation order of the contributed filter
        // within the pipeline.
       
    configuration.add("Timing", timingFilter);
        configuration.add("Utf8Filter", utf8Filter);
    }
hitalang 2007-11-25
不好用,报错-.麻烦请楼上说清楚点,谢谢!
Global site tag (gtag.js) - Google Analytics