2012-04-19 64 views
5

我有我的列表网格没有正确显示符号的问题,我发现,当我从java插入到数据库中的值已被窃听。JBoss编码utf 8

一个帖子在这里帮助,我改变了我的项目属性 - >文本编码 - >其他 - > UTF-8,这解决了我的问题。事情是这只能解决我的问题在本地。

我需要做的是在我的Jboss服务器上也以某种方式设置编码。我只能访问此面板,因为我无法直接访问配置文件。我可以从这里做到吗?

enter image description here

任何建议表示赞赏,并为这个愚蠢的问题,抱歉,但我都试过了,我可以没有成功想到的。谢谢。

回答

6

这可能会帮助你https://community.jboss.org/message/643825#643825

<system-properties> 
    <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/> 
    <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/> 
</system-properties> 
+2

对于JBoss <7,增加的URIEncoding = “UTF-8”,以 /server/deploy/jbossweb.sar/server.xml连接器 – BoneGoat 2014-03-18 15:19:46

1

要确定,你有这样的pageEncoding的东西?

<%@page contentType="text/html" pageEncoding="UTF-8"%> 
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> 
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> 
<f:loadBundle basename="i18n.messages" var="msg"/> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
0

也许这将是有用的人:

Window > Preferences > General > Workspace > Text file encoding

0

您可以创建拦截在你的应用的每个请求的过滤器,所以进入这个过滤器你可以设置字符编码。有一个线程在developer.jboss。该过滤器可以是如下:

@WebFilter(filterName = "CharacterEncodingF", urlPatterns = {"/*"}) 
    public class CharacterEncodingF implements Filter { 


    public CharacterEncodingF() { 
    } 


    /** 
    * 
    * @param request The servlet request we are processing 
    * @param response The servlet response we are creating 
    * @param chain The filter chain we are processing 
    * 
    * @exception IOException if an input/output error occurs 
    * @exception ServletException if a servlet error occurs 
    */ 
    public void doFilter(ServletRequest request, ServletResponse response, 
      FilterChain chain) 
      throws IOException, ServletException { 

     request.setCharacterEncoding("UTF-8"); 
     chain.doFilter(request, response); 

    } 

    @Override 
    public void init(FilterConfig filterConfig) throws ServletException { 
    } 

    @Override 
    public void destroy() { 
    } 


}