How can I cleanly set the pageEncoding of all my JSPs?

前端 未结 1 712
孤城傲影
孤城傲影 2020-11-30 10:12

I need to encode all of my JSPs as UTF-8.

I\'ve looked around and found that I can use the following page directive to accomplish this:

<%@page pa         


        
相关标签:
1条回答
  • 2020-11-30 10:39

    Put the following in your web.xml to achieve the goal.

    <jsp-config>
        <jsp-property-group>
            <url-pattern>*.jsp</url-pattern>
            <page-encoding>UTF-8</page-encoding>
        </jsp-property-group>
    </jsp-config>
    

    See also:

    • Unicode - How to get the characters right? - JSP/Servlet response
    0 讨论(0)
提交回复
热议问题