Ravindra Gullapalli
Ravindra Gullapalli

Reputation: 9158

Issue in UTF-8 in GlassFish 4.0

I have a JSP page where the user can input unicode characters and the server has to store those unicode characters properly into the SQL Server database.

My code in which I set page encoding in JSP and character encoding in a filter used to work perfectly in Apache Geronimo. However, when I deploy the same code in GlassFish 4.0, it started storing "?" in the database.

I followed the instructions given in this blog post and added parameter-encoding tag in glassfish-web.xml and also added jsp-config in web.xml

and in my Servlet i am converting the input to UTF as new String([Parameter].getBytes("ISO-8859-1"), "UTF-8") Here it gives me ?

I am not able to figure out what am I doing wrong. Please suggest a workaround.

Upvotes: 2

Views: 981

Answers (1)

Ravindra Gullapalli
Ravindra Gullapalli

Reputation: 9158

@developerwjk Thank you for the hint. There is a property SendStringParametersAsUnicode in Additional Properties of JDBC Connection Pool. This we have to set to true.

In fact, after doing this, it is working with out above said entries in web.xml and glassfish-web.xml.

Upvotes: 2

Related Questions