jsp中的include静态页面出现乱码问题
在当前应用系统的web.xml里加入jsp-config代码:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<jsp-config>
<jsp-property-group>
<description>
Special property group for JSP Configuration JSP example.
</description>
<display-name>JSPConfiguration</display-name>
<url-pattern>*.jsp</url-pattern>
<el-ignored>true</el-ignored>
<page-encoding>GB2312</page-encoding>
<scripting-invalid>false</scripting-invalid>
<include-prelude></include-prelude>
<include-coda></include-coda>
<description>
Special property group for JSP Configuration JSP example.
</description>
<display-name>JSPConfiguration</display-name>
<url-pattern>*.html</url-pattern>
<el-ignored>true</el-ignored>
<page-encoding>GB2312</page-encoding>
<scripting-invalid>false</scripting-invalid>
<include-prelude></include-prelude>
<include-coda></include-coda>
</jsp-property-group>
</jsp-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
... ...
</webapp>
说明:<jsp-config>里的定义,就是通知当前应用服务器,当前应用系统下,所有的 .jsp, .html 文件,若是没有定义contentType="text/html;charset=gb2312" 时,就会采用预设的 "GB2312" 字符集去处理,如此,就不须要在每个 include 的档案第一行加上 contentType="text/html;charset=gb2312" 了。
相关文档:
昨天在写东西的时候,数据库用的编码是UTF-8,页面也是UTF-8,然后存进数据库的时发现还是乱码。中文的时候,随后debug,查到Action里面得到的表单内容也是乱码,哈哈
问题找到了,原来是Form表单或者其他地方有问题
后来在web.xml中加上对Spring编码的控制语句,好了...呵呵
......
转自:http://www.centospub.com/make/servlet.html
前 言
所谓 Java Servlet ,是指用 Java 语言,实现动态网页的创建的功能,一般把简单的把它称为“Servlet”(无中文译文)的情况比较常见。和它处于同等类别的技术还有我们知道的Perl、PHP、ASP等等。Servlet算是J2EE中的一部分,所以在企业应用方面 ......
package com.lsf;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFCell;
import java.sql.*;
import java.io.*;
import java.util.ArrayList;
import java.sql.Co ......