java.lang.IllegalArgumentException: Resources cannot be null.可能的原因是因為在struts-config.xml文件中沒有為驗證框架注冊
配置過濾器 設置字符集為GBK (注:mysql數據庫和JSP頁面都是使用GBK字符集)
CharFilterToGBK javax.servlet.Filter;
[client]
port=3306
[mysql]
default-character-set=gbk
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
#Path to installation directory. All paths are usually resolved relative to this.
basedir="D:/Program Files/MySQL/MySQL Server 5.1/"
#Path to the database root
datadir="D:/Program Files/MySQL/MySQL Server 5.1/Application Data/Data/"
# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=gbk
# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB
- 使用MySQL Workbench設計數據庫 ,數據庫和表均使用默認的字符集
- 在Servlet中轉換字符編碼
String name = request.getParameter("name");
name = new String(name.getBytes("ISO-8859-1"));
- 設置JSP頁面字符集為GBK
<%@ page language="java" pageEncoding="GBK"%>