Glass fish coding

I use the code in this example example and in the runUpdate () function that I introduced in javabean in a web application in Netbeans 6.8 with Glassfish v3. I seem to have a problem with the encoding because question marks appear in the table.

I have tried so far:

  • In nbproject-> private-> private.properties add runtime.encoding = UTF-8>
  • In the project-> properties-> sources-> encoding utf-8
  • In the program files-> netbeans-> etc-> netbeans_conf in netbeans_default_options I add -J-DFile.encoding = UTF-8
  • In the project-> properties-> build-> compiling-> additional compiler options -encoding utf-8
  • In sun-web.xml, I added <locale-charset-info default-locale="UTF-8"> <locale-charset-map locale="" charset=""/> <parameter-encoding default-charset="UTF-8"/> </locale-charset-info>

Also, when I use system.out.print () in the glass fish output panel, I get gibberish. I'm at the last level of madness, please take a look. Thanks.

EDIT Also, when I do a .5 listing, I get an error in a glass box:

 WARNING: WEB0500: default-locale attribute of locale-charset-info element is being ignored 
+5
source share
3 answers

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

+6
source

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

To change the default encoding of the POST fields, I put it on 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 am not sure if this will help you, but it may help other people having the same problem as me.

+14
source

Are you sure your browser is set to UTF-8. By default, most browsers do not display in UTF. Start with a browser and work backwards. Is your data source storing data in UTF-8? By default, Java is in UTF-8, so I'm not sure if GF is your real problem.

-1
source

Source: https://habr.com/ru/post/977811/


All Articles