Wednesday, April 9, 2008

Encoding JSP Pages globally with specific encoding (Servlet 2.4 onwards)

if you are using servlet 2.4 and jsp 2.0
you can use the following special config in web.xml:

<jsp-config>
<jsp-property-group>
<display-name>Setup default encoding</display-name>
<url-pattern>*.jsp</url-pattern>
<page-encoding>ISO8859-1</page-encoding>
</jsp-property-group>
</jsp-config>

Reference article:
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jsps/jspconfig/jspconfig.html#encode

No comments: