Glassfish encoding

前端 未结 3 1673
野的像风
野的像风 2021-02-09 14:54

I\'m using the code in this example example and in the runUpdate() function which i put in a javabean in a web application in Netbeans 6.8 with Glassfish v3. It seems i have an

相关标签:
3条回答
  • 2021-02-09 15:22

    Are you sure your browser is set to UTF-8. By default most browsers do not display in UTF. Start with the browser and work backwards. Is your datasource storing the data in UTF-8? By default Java is in UTF-8 so I am not sure that GF is your real issue.

    0 讨论(0)
  • 2021-02-09 15:28

    Glassfish uses ISO-8859-1 encoding by default. See http://download.oracle.com/docs/cd/E19798-01/821-1752/beafu/index.html for more information.

    0 讨论(0)
  • 2021-02-09 15:33

    Have you tried using glassfish-web.xml instead of sun-web.xml ?

    To change default Glassfish POST fields encoding, I put this to WEB-INF/glassfish-web.xml, and it worked (I use glassfish 3.1.2):

    <!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD
    GlassFish Application Server 3.1 Servlet 3.0//EN"
    "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
    <glassfish-web-app>
        <parameter-encoding default-charset="UTF-8" />
    </glassfish-web-app>
    

    I'm not sure if it will help you, but may help other people having the same problem as me.

    0 讨论(0)
提交回复
热议问题