jspにおけるinclude静的ファイルの乱符号化解決方法

1518 ワード

jspでhtmlなどのinclude静的ファイルを表示する場合の文字化けしの解決方法は、次のとおりです.
1.jspのヘッダコードに
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8" %>

 2. 工事のwebでxmlで追加
<jsp-config>
        <jsp-property-group>
            <description>jsp encoding example</description>
            <display-name>JSPConfiguration</display-name>
            <url-pattern>*.jsp</url-pattern>
            <el-ignored>true</el-ignored>
            <page-encoding>UTF-8</page-encoding>
            <scripting-invalid>false</scripting-invalid>
            <include-prelude></include-prelude>
            <include-coda></include-coda>

            <description>html encoding example</description>
            <display-name>JSPConfiguration</display-name>
            <url-pattern>*.html</url-pattern>
            <el-ignored>true</el-ignored>
            <page-encoding>UTF-8</page-encoding>
            <scripting-invalid>false</scripting-invalid>
            <include-prelude></include-prelude>
            <include-coda></include-coda>
        </jsp-property-group>
    </jsp-config>

htmlの文字化けしを解決します.