jsp中文顯示問號問題解決方法

字號:


    jsp中想要輸出的中文被顯示成問號?在eclipse-windows- preferences中搜索jsp,Encoding選項中選擇 Chinese,此問題便可解決
    問題: jsp中想要輸出的中文被顯示成“?”
    解決方法 : 在eclipse-windows- preferences中 搜索jsp , Encoding選項中選擇 Chinese 。 這樣新建的jsp文件將支持中文顯示。
    對已經(jīng)存在的jsp文件做如下修改: 將各種編碼方式都改成GB18030,如下:
    代碼如下:
    <%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GB18030">
    <title>Hello</title>
    </head>
    <body>
    你好
    </body>
    </html>
    則“你好”可正確顯示