我是靠谱客的博主 活力音响,最近开发中收集的这篇文章主要介绍java中设置请求编码的_java – 无法从上下文将请求字符编码设置为UTF-8 History Center,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

参见英文答案 >

Unicode input retrieved via PrimeFaces input components become corrupted1个

我正在尝试将Primefaces中的示例实现为WAB包.

xmlns:h="http://java.sun.com/jsf/html"

xmlns:f="http://java.sun.com/jsf/core"

xmlns:ui="http://java.sun.com/jsf/facelets"

xmlns:p="http://primefaces.org/ui" >

nvidia.com History Center

title="Basic Bar Chart" min="0" max="200" style="height:300px"/>

title="Horizontal Bar Chart" orientation="horizontal" min="0" max="200"/>

title="Stacked Bar Chart" stacked="true" barMargin="50" min="0" max="300"/>

import org.glassfish.osgicdi.OSGiService;

import org.primefaces.model.chart.CartesianChartModel;

import org.primefaces.model.chart.ChartSeries;

// Update form example

@Named("LinuxController")

@SessionScoped

public class Linux implements Serializable {

private CartesianChartModel categoryModel;

public Linux() {

createCategoryModel();

}

public CartesianChartModel getCategoryModel() {

return categoryModel;

}

private void createCategoryModel() {

categoryModel = new CartesianChartModel();

ChartSeries boys = new ChartSeries();

boys.setLabel("Boys");

boys.set("2004",120);

boys.set("2005",100);

boys.set("2006",44);

boys.set("2007",150);

boys.set("2008",25);

ChartSeries girls = new ChartSeries();

girls.setLabel("Girls");

girls.set("2004",52);

girls.set("2005",60);

girls.set("2006",110);

girls.set("2007",135);

girls.set("2008",120);

categoryModel.addSeries(boys);

categoryModel.addSeries(girls);

}

}

当我尝试访问JSF页面时,页面为空.我在Glassfish日志文件中收到此错误:

[#|2012-06-06T20:53:47.931+0300|WARNING|glassfish3.1.2|org.apache.catalina.connector.Request|_ThreadID=321;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context /test,because request parameters have already been read,or ServletRequest.getReader() has already been called|#]

[#|2012-06-06T20:53:48.880+0300|WARNING|glassfish3.1.2|org.apache.catalina.connector.Request|_ThreadID=323;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context /test,or ServletRequest.getReader() has already been called|#]

[#|2012-06-06T20:53:52.714+0300|WARNING|glassfish3.1.2|org.apache.catalina.connector.Request|_ThreadID=321;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context /test,or ServletRequest.getReader() has already been called|#]

[#|2012-06-06T20:53:56.434+0300|WARNING|glassfish3.1.2|org.apache.catalina.connector.Request|_ThreadID=324;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context /test,or ServletRequest.getReader() has already been called|#]

[#|2012-06-06T20:53:57.591+0300|WARNING|glassfish3.1.2|org.apache.catalina.connector.Request|_ThreadID=322;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context /test,or ServletRequest.getReader() has already been called|#]

[#|2012-06-06T20:54:25.828+0300|WARNING|glassfish3.1.2|org.apache.catalina.connector.Request|_ThreadID=323;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context /test,or ServletRequest.getReader() has already been called|#]

[#|2012-06-06T20:54:26.912+0300|WARNING|glassfish3.1.2|org.apache.catalina.connector.Request|_ThreadID=321;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context /test,or ServletRequest.getReader() has already been called|#]

[#|2012-06-06T20:54:28.010+0300|WARNING|glassfish3.1.2|org.apache.catalina.connector.Request|_ThreadID=324;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context /test,or ServletRequest.getReader() has already been called|#]

我该如何解决这个问题?我想这可能是由POM配置引起的?

最后

以上就是活力音响为你收集整理的java中设置请求编码的_java – 无法从上下文将请求字符编码设置为UTF-8 History Center的全部内容,希望文章能够帮你解决java中设置请求编码的_java – 无法从上下文将请求字符编码设置为UTF-8 History Center所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(51)

评论列表共有 0 条评论

立即
投稿
返回
顶部