Goods Step01:工具类的编写
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Goods Step01:工具类的编写相关的知识,希望对你有一定的参考价值。
1.导包和配置文件:
/WebContent/WEB-INF/lib
activation.jar
c3p0-0.9.2-pre1.jar
c3p0-oracle-thin-extras-0.9.2-pre1.jar
commons-beanutils-1.8.3.jar
commons-collections-3.0.jar
commons-dbutils-1.4.jar
commons-fileupload-1.2.2.jar
commons-io-1.4.jar
commons-lang-2.1.jar
commons-logging-1.1.1.jar
mail.jar
mchange-commons-0.2.jar
mysql-connector-java-5.1.39-bin.jar
config
c3p0-config.xml
log4j.properties
2.工具类的编写src
cn.anstone.util.jdbc
2.1 JdbcUtils.java
2.2 TxQueryRunner.java
cn.anstone.util.mail
2.3 Mail.java
2.4 MailUtils.java
2.5 AttachBean.java
cn.anstone.util.vcode
2.6 VerifyCode.java
2.7 VerifyCodeServlet.java
cn.anstone.util.filter
2.8 EncodingFilter.java
2.9 GetRequest.java
2.10 LoginFilter.java
cn.anstone.util
2.11 CommonUtils.java
2.12 DateConverter.java
2.13 BaseServlet.java
3.测试工具类test
-- ----------------------------
-- 根据cn.anstone.util中的实体类创建数据表
-- ----------------------------
3.1 test.sql
/*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50714
Source Host : localhost:3306
Source Database : test
Target Server Type : MYSQL
Target Server Version : 50714
File Encoding : 65001
Date: 2016-12-04 10:42:57
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `t_address`
-- ----------------------------
DROP TABLE IF EXISTS `t_address`;
CREATE TABLE `t_address` (
`addrId` varchar(40) NOT NULL,
`province` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`district` varchar(255) DEFAULT NULL,
`street` varchar(255) DEFAULT NULL,
PRIMARY KEY (`addrId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_address
-- ----------------------------
INSERT INTO `t_address` VALUES (‘424544‘, ‘湖南省‘, ‘张家界市‘, ‘永定区‘, ‘张家界学院‘);
INSERT INTO `t_address` VALUES (‘427000‘, ‘湖南省‘, ‘张家界市‘, ‘永定区‘, ‘吉首大学‘);
-- ----------------------------
-- Table structure for `t_user`
-- ----------------------------
DROP TABLE IF EXISTS `t_user`;
CREATE TABLE `t_user` (
`userId` varchar(40) NOT NULL,
`UserName` varchar(40) DEFAULT NULL,
`age` int(20) DEFAULT NULL,
`sex` varchar(20) DEFAULT NULL,
`addrId` varchar(40) DEFAULT NULL,
PRIMARY KEY (`userId`),
UNIQUE KEY `USER_NAME` (`UserName`),
KEY `FK_AddrId_1` (`addrId`),
CONSTRAINT `FK_AddrId_1` FOREIGN KEY (`addrId`) REFERENCES `t_address` (`addrId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_user
-- ----------------------------
INSERT INTO `t_user` VALUES (‘1001‘, ‘黑崎一护‘, ‘100‘, ‘男‘, ‘427000‘);
INSERT INTO `t_user` VALUES (‘1003‘, ‘石田雨龙‘, ‘33‘, ‘男‘, ‘427000‘);
INSERT INTO `t_user` VALUES (‘1004‘, ‘黑崎一心‘, ‘26‘, ‘男‘, ‘424544‘);
INSERT INTO `t_user` VALUES (‘1005‘, ‘朽木白哉‘, ‘26‘, ‘男‘, ‘424544‘);
3.2 cn.anstone.util
Address.java
CommonUtilsTest.java
JdbcUtilsTest.java
MailUtilsTest.java
TxQueryRunnerTest.java
User.java
3.3 cn.anstone.servlet
AServlet.java
LoginServlet.java
3.4 /WebContent/test
form.jsp
index.jsp
以上是关于Goods Step01:工具类的编写的主要内容,如果未能解决你的问题,请参考以下文章
图书管理系统( JSP + JDBC + Servlet )实现-03:项目搭建 & 工具类的实现 &依赖导入