├── .classpath ├── .mymetadata ├── .project ├── .settings ├── .jsdtscope ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs ├── org.eclipse.wst.common.component ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.wst.jsdt.ui.superType.container └── org.eclipse.wst.jsdt.ui.superType.name ├── README.md ├── WebRoot ├── META-INF │ └── MANIFEST.MF ├── WEB-INF │ ├── classes │ │ ├── c3p0-config.xml │ │ ├── cn │ │ │ └── hncu │ │ │ │ ├── article │ │ │ │ ├── dao │ │ │ │ │ ├── ArticleDaoJdbc.class │ │ │ │ │ └── IArticleDao.class │ │ │ │ ├── service │ │ │ │ │ ├── ArticleServiceImpl.class │ │ │ │ │ └── IArticleService.class │ │ │ │ └── servlet │ │ │ │ │ ├── ArticleServlet.class │ │ │ │ │ ├── ReadNumThread.class │ │ │ │ │ └── replyThread.class │ │ │ │ ├── domain │ │ │ │ ├── Info.class │ │ │ │ ├── InfoAndReply.class │ │ │ │ ├── InfoMod.class │ │ │ │ ├── Reply.class │ │ │ │ └── User.class │ │ │ │ ├── filter │ │ │ │ ├── AdminLoginFilter.class │ │ │ │ ├── CharFilter.class │ │ │ │ └── UserLoginFilter.class │ │ │ │ ├── index │ │ │ │ ├── dao │ │ │ │ │ ├── IIndexDao.class │ │ │ │ │ └── IndexDaoJdbc.class │ │ │ │ ├── service │ │ │ │ │ ├── IIndexService.class │ │ │ │ │ └── IndexServiceImpl.class │ │ │ │ └── servlet │ │ │ │ │ └── IndexServlet.class │ │ │ │ ├── publish │ │ │ │ ├── dao │ │ │ │ │ ├── IPublishDao.class │ │ │ │ │ └── PublishDaoJdbc.class │ │ │ │ ├── service │ │ │ │ │ ├── IPublishService.class │ │ │ │ │ └── PublishServiceImpl.class │ │ │ │ └── servlet │ │ │ │ │ └── PublishServlet.class │ │ │ │ ├── test │ │ │ │ ├── TestConn$1.class │ │ │ │ └── TestConn.class │ │ │ │ ├── user │ │ │ │ ├── dao │ │ │ │ │ ├── IUserDao.class │ │ │ │ │ └── UserDaoJdbc.class │ │ │ │ ├── service │ │ │ │ │ ├── IUserService.class │ │ │ │ │ └── UserServiceImpl.class │ │ │ │ └── servlet │ │ │ │ │ ├── IPThread.class │ │ │ │ │ └── UserServlet.class │ │ │ │ └── utils │ │ │ │ ├── BaseDomain.class │ │ │ │ ├── BaseServlet.class │ │ │ │ ├── BeanUtils.class │ │ │ │ ├── DataSourceUtils.class │ │ │ │ ├── EnhanceBaseServlet.class │ │ │ │ ├── IDUtils.class │ │ │ │ ├── MyRequest.class │ │ │ │ ├── PasswordUtils.class │ │ │ │ ├── QueryRunner.class │ │ │ │ └── tx │ │ │ │ ├── Transaction.class │ │ │ │ └── TxProxy.class │ │ └── log4j.properties │ ├── lib │ │ ├── c3p0-0.9.1.2.jar │ │ ├── commons-beanutils-1.8.3.jar │ │ ├── commons-dbutils-1.3.jar │ │ ├── commons-fileupload-1.2.2.jar │ │ ├── commons-io-2.1.jar │ │ ├── commons-logging.jar │ │ ├── cos.jar │ │ ├── jstl-1.2.jar │ │ ├── junit-4.7.jar │ │ ├── log4j-1.2.15.jar │ │ ├── mysql-connector-java-5.1.39-bin.jar │ │ └── spring-security-core-3.1.0.RELEASE.jar │ └── web.xml ├── css │ └── index.css ├── in.jsp ├── index.jsp ├── jsps │ ├── article │ │ ├── article.jsp │ │ ├── css │ │ │ └── article.css │ │ └── js │ │ │ └── article.js │ ├── publish │ │ ├── css │ │ │ └── publish.css │ │ ├── js │ │ │ └── publish.js │ │ └── publish.jsp │ └── user │ │ ├── css │ │ └── reg.css │ │ ├── js │ │ ├── jquery-3.1.0.js │ │ ├── log.js │ │ └── reg.js │ │ ├── log.jsp │ │ └── reg.jsp └── userLog.jsp ├── build.xml ├── sql └── create │ └── 1.sql └── src ├── c3p0-config.xml ├── cn └── hncu │ ├── article │ ├── dao │ │ ├── ArticleDaoJdbc.java │ │ └── IArticleDao.java │ ├── service │ │ ├── ArticleServiceImpl.java │ │ └── IArticleService.java │ └── servlet │ │ ├── ArticleServlet.java │ │ ├── ReadNumThread.java │ │ └── replyThread.java │ ├── domain │ ├── Info.java │ ├── InfoAndReply.java │ ├── InfoMod.java │ ├── Reply.java │ └── User.java │ ├── filter │ ├── AdminLoginFilter.java │ ├── CharFilter.java │ └── UserLoginFilter.java │ ├── index │ ├── dao │ │ ├── IIndexDao.java │ │ └── IndexDaoJdbc.java │ ├── service │ │ ├── IIndexService.java │ │ └── IndexServiceImpl.java │ └── servlet │ │ └── IndexServlet.java │ ├── publish │ ├── dao │ │ ├── IPublishDao.java │ │ └── PublishDaoJdbc.java │ ├── service │ │ ├── IPublishService.java │ │ └── PublishServiceImpl.java │ └── servlet │ │ └── PublishServlet.java │ ├── test │ └── TestConn.java │ ├── user │ ├── dao │ │ ├── IUserDao.java │ │ └── UserDaoJdbc.java │ ├── service │ │ ├── IUserService.java │ │ └── UserServiceImpl.java │ └── servlet │ │ ├── IPThread.java │ │ └── UserServlet.java │ └── utils │ ├── BaseDomain.java │ ├── BaseServlet.java │ ├── BeanUtils.java │ ├── DataSourceUtils.java │ ├── EnhanceBaseServlet.java │ ├── IDUtils.java │ ├── PasswordUtils.java │ ├── QueryRunner.java │ └── tx │ ├── Transaction.java │ └── TxProxy.java └── log4j.properties /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.mymetadata: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | codeforum 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.common.project.facet.core.builder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.jsdt.core.javascriptValidator 15 | 16 | 17 | 18 | 19 | com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.jdt.core.javabuilder 25 | 26 | 27 | 28 | 29 | com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator 30 | 31 | 32 | 33 | 34 | com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator 35 | 36 | 37 | 38 | 39 | org.eclipse.wst.validation.validationbuilder 40 | 41 | 42 | 43 | 44 | com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder 45 | 46 | 47 | 48 | 49 | 50 | com.genuitec.eclipse.ast.deploy.core.deploymentnature 51 | org.eclipse.jem.workbench.JavaEMFNature 52 | com.genuitec.eclipse.j2eedt.core.webnature 53 | org.eclipse.jdt.core.javanature 54 | org.eclipse.wst.jsdt.core.jsNature 55 | org.eclipse.wst.common.project.facet.core.nature 56 | org.eclipse.wst.common.modulecore.ModuleCoreNature 57 | 58 | 59 | -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | #Sat Jan 07 20:23:59 CST 2017 2 | eclipse.preferences.version=1 3 | encoding//WebRoot/jsps/publish/publish.jsp=UTF-8 4 | encoding//WebRoot/userLog.jsp=UTF-8 5 | encoding//src/log4j.properties=UTF-8 6 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | #Wed Apr 04 20:27:57 CST 2012 2 | eclipse.preferences.version=1 3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 5 | org.eclipse.jdt.core.compiler.compliance=1.5 6 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 这是我们数据库的一个课程设计,时间不多,老师只留给我们5天的时间做。 2 | 3 | 数据库为MySQL。 4 | 5 | 先说下功能吧: 6 | 注意:本项目没有用框架! 7 | 实现了登录注册。用户查看帖子。 8 | 用户积分政策。帖子按阅读量排名。 9 | 用户发表帖子。用户评论帖子。 10 | 11 | 用到的技术有: 12 | AJAX、jQuery、ant、分页技术、拦截器、底层实现动态注解拦截、实现数据库事务处理、使用org.apache.commons.beanutils.BeanUtils封装Bean、ThreadLocal处理线程、重写QueryRunner抓取异常、在dao层就不必再抓取异常、还有一些时间,密码的工具类、、、 13 | 14 | 因为时间有限,只写了这些功能,如有兴趣,完全可以在这个基础上开发出一个小型论坛。 15 | 积分的那个,本来是想写一个权限管理的,奈何时间不让。 16 | 而且现在Spring实现权限管理比较简单,也就没写了。 17 | 其他你想要的功能你自己都可以加哦。 18 | 19 | 本项目比较简单,就不做过多介绍啦,有兴趣的可以拿去,所有源码都在,sql语句在项目根目录下。 20 | 21 | 数据库只有3个表: 22 | ![](http://img.blog.csdn.net/20170107204746740?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMjY1MjUyMTU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast) 23 | 24 | 25 | 未登录时的首页: 26 | ![](http://img.blog.csdn.net/20170107204824788?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMjY1MjUyMTU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast) 27 | 28 | 登录页面: 29 | 30 | ![](http://img.blog.csdn.net/20170107204857210?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMjY1MjUyMTU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast) 31 | 32 | 登录后的首页: 33 | 34 | ![](http://img.blog.csdn.net/20170107204927290?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMjY1MjUyMTU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast) 35 | 36 | 帖子页面: 37 | ![](http://img.blog.csdn.net/20170107205110930?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMjY1MjUyMTU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast) 38 | 39 | 发表帖子页面: 40 | ![](http://img.blog.csdn.net/20170107205142446?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMjY1MjUyMTU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast) 41 | 42 | 注册页面: 43 | ![](http://img.blog.csdn.net/20170107205206603?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMjY1MjUyMTU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast) 44 | 45 | 46 | 好像页面也就这些啦,本人不是做UI哒,页面不好看请见谅哦。 47 | 时间也比较紧,也就没去网上找模板了。 48 | 相信这个项目应付学校的课程设计是完全够了的。 -------------------------------------------------------------------------------- /WebRoot/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/c3p0-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 30000 5 | 30 6 | 10 7 | 30 8 | 100 9 | 10 10 | 200 11 | 12 | 10 13 | 1 14 | 0 15 | 16 | 17 | 18 | 19 | oracle.jdbc.driver.OracleDriver 20 | 21 | jdbc:oracle:thin:@127.0.0.1:1521:codeforum 22 | 23 | system 24 | 123456 25 | 2 26 | 2 27 | 2 28 | 10 29 | 50 30 | 5 31 | 32 | 33 | 34 | 35 | com.mysql.jdbc.Driver 36 | 37 | 38 | 39 | root 40 | 1234 41 | 10 42 | 20 43 | 10 44 | 100 45 | 500 46 | 5 47 | 48 | 49 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/article/dao/ArticleDaoJdbc.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/article/dao/ArticleDaoJdbc.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/article/dao/IArticleDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/article/dao/IArticleDao.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/article/service/ArticleServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/article/service/ArticleServiceImpl.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/article/service/IArticleService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/article/service/IArticleService.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/article/servlet/ArticleServlet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/article/servlet/ArticleServlet.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/article/servlet/ReadNumThread.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/article/servlet/ReadNumThread.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/article/servlet/replyThread.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/article/servlet/replyThread.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/domain/Info.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/domain/Info.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/domain/InfoAndReply.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/domain/InfoAndReply.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/domain/InfoMod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/domain/InfoMod.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/domain/Reply.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/domain/Reply.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/domain/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/domain/User.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/filter/AdminLoginFilter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/filter/AdminLoginFilter.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/filter/CharFilter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/filter/CharFilter.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/filter/UserLoginFilter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/filter/UserLoginFilter.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/index/dao/IIndexDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/index/dao/IIndexDao.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/index/dao/IndexDaoJdbc.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/index/dao/IndexDaoJdbc.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/index/service/IIndexService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/index/service/IIndexService.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/index/service/IndexServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/index/service/IndexServiceImpl.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/index/servlet/IndexServlet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/index/servlet/IndexServlet.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/publish/dao/IPublishDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/publish/dao/IPublishDao.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/publish/dao/PublishDaoJdbc.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/publish/dao/PublishDaoJdbc.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/publish/service/IPublishService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/publish/service/IPublishService.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/publish/service/PublishServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/publish/service/PublishServiceImpl.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/publish/servlet/PublishServlet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/publish/servlet/PublishServlet.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/test/TestConn$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/test/TestConn$1.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/test/TestConn.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/test/TestConn.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/user/dao/IUserDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/user/dao/IUserDao.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/user/dao/UserDaoJdbc.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/user/dao/UserDaoJdbc.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/user/service/IUserService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/user/service/IUserService.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/user/service/UserServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/user/service/UserServiceImpl.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/user/servlet/IPThread.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/user/servlet/IPThread.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/user/servlet/UserServlet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/user/servlet/UserServlet.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/utils/BaseDomain.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/utils/BaseDomain.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/utils/BaseServlet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/utils/BaseServlet.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/utils/BeanUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/utils/BeanUtils.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/utils/DataSourceUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/utils/DataSourceUtils.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/utils/EnhanceBaseServlet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/utils/EnhanceBaseServlet.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/utils/IDUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/utils/IDUtils.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/utils/MyRequest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/utils/MyRequest.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/utils/PasswordUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/utils/PasswordUtils.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/utils/QueryRunner.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/utils/QueryRunner.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/utils/tx/Transaction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/utils/tx/Transaction.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/cn/hncu/utils/tx/TxProxy.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/classes/cn/hncu/utils/tx/TxProxy.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, stdout, logfile 2 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 3 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.stdout.layout.ConversionPattern=%d %p [%c<%L>] - <%m>%n 5 | 6 | log4j.appender.logfile=org.apache.log4j.RollingFileAppender 7 | log4j.appender.logfile.File=d:/codeforum/codeforum.log 8 | log4j.appender.logfile.MaxFileSize=5120KB 9 | log4j.appender.logfile.MaxBackupIndex=3 10 | log4j.appender.logfile.layout=org.apache.log4j.PatternLayout 11 | log4j.appender.logfile.layout.ConversionPattern=%d %p [%c<%L>] - %m%n -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/c3p0-0.9.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/lib/c3p0-0.9.1.2.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/commons-beanutils-1.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/lib/commons-beanutils-1.8.3.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/commons-dbutils-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/lib/commons-dbutils-1.3.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/commons-fileupload-1.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/lib/commons-fileupload-1.2.2.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/commons-io-2.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/lib/commons-io-2.1.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/commons-logging.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/lib/commons-logging.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/cos.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/lib/cos.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/jstl-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/lib/jstl-1.2.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/junit-4.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/lib/junit-4.7.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/log4j-1.2.15.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/lib/log4j-1.2.15.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/mysql-connector-java-5.1.39-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/lib/mysql-connector-java-5.1.39-bin.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/spring-security-core-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenhaoxiang/codeforum/d6f830f4cbcf3fc2e156df6702207b61ea67d222/WebRoot/WEB-INF/lib/spring-security-core-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | char 11 | cn.hncu.filter.CharFilter 12 | 13 | 14 | 15 | UserLogin 16 | cn.hncu.filter.UserLoginFilter 17 | 18 | loginPage 19 | /jsps/user/log.jsp 20 | 21 | 22 | 23 | 24 | char 25 | /* 26 | 27 | 28 | UserLogin 29 | 30 | /articleServlet 31 | 32 | 33 | 34 | 35 | user 36 | cn.hncu.user.servlet.UserServlet 37 | 38 | reg 39 | /jsps/user/reg.jsp 40 | 41 | 42 | regSuccess 43 | /jsps/user/regsucc.jsp 44 | 45 | 46 | index 47 | index.jsp 48 | 49 | 50 | article 51 | 52 | articleServlet 53 | 54 | 55 | 56 | 57 | IndexServlet 58 | cn.hncu.index.servlet.IndexServlet 59 | 60 | index 61 | /in.jsp 62 | 63 | 64 | 65 | 66 | ArticleServlet 67 | cn.hncu.article.servlet.ArticleServlet 68 | 69 | article 70 | /jsps/article/article.jsp 71 | 72 | 73 | index 74 | /index.jsp 75 | 76 | 77 | 78 | 79 | 80 | 81 | PublishServlet 82 | cn.hncu.publish.servlet.PublishServlet 83 | 84 | 85 | 86 | IndexServlet 87 | /IndexServlet 88 | 89 | 90 | user 91 | /user 92 | 93 | 94 | ArticleServlet 95 | /articleServlet 96 | 97 | 98 | PublishServlet 99 | /publishServlet 100 | 101 | 102 | 103 | 104 | index.jsp 105 | 106 | 107 | -------------------------------------------------------------------------------- /WebRoot/css/index.css: -------------------------------------------------------------------------------- 1 | body{ 2 | text-align: center; 3 | } 4 | /*去掉a标签下划线*/ 5 | a{ 6 | text-decoration:none; 7 | } 8 | .divhot{ 9 | text-align: left; 10 | position: relative; 11 | margin-bottom: 10px; 12 | margin-top: 10px; 13 | } 14 | .tiezi{ 15 | position: relative; 16 | left: 0px; 17 | top: 0px; 18 | margin-bottom: 10px; 19 | margin-top: 10px; 20 | } 21 | .tiezi_p{ 22 | font-size: 15px; 23 | } 24 | 25 | .pc{ 26 | width: 30px; 27 | height: 30px; 28 | border: 1px solid #e1e2e3; 29 | border-top-color: rgb(225, 226, 227); 30 | border-top-style: solid; 31 | border-top-width: 1px; 32 | border-right-color: rgb(225, 226, 227); 33 | border-right-style: solid; 34 | border-right-width: 1px; 35 | border-bottom-color: rgb(225, 226, 227); 36 | border-bottom-style: solid; 37 | border-bottom-width: 1px; 38 | border-left-color: rgb(225, 226, 227); 39 | border-left-style: solid; 40 | border-left-width: 1px; 41 | } 42 | .now { 43 | display: block; 44 | } 45 | -------------------------------------------------------------------------------- /WebRoot/in.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 3 | 4 | 5 | 城院论坛 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |     火热的帖子: 15 | 16 |
17 |            18 | ${infoHot.title} 19 | 20 |   —作者:${infoHot.name}  阅读量:${infoHot.readNum} 21 | 22 |
23 |
24 |
25 |
26 | 所有帖子: 27 | 28 |
29 |            30 | ${data.title} 31 | 32 |   —作者:${data.name}  阅读量:${data.readNum} 33 | 34 |
35 |
36 |
37 | 38 | 39 | 40 | 上一页 41 | 42 | 43 |    44 | 45 | 46 | ${idx} 47 | 48 | 49 | 50 | ${idx} 51 | 52 | 53 |    54 | 55 | 56 | 57 | 58 | 下一页 59 | 60 | 61 |

62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /WebRoot/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 3 | 4 | 5 | 城院论坛 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /WebRoot/jsps/article/article.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 |
22 |
23 |
24 | ${sessionScope.article.title}
25 | ——作者:${sessionScope.article.name}  发表时间:${sessionScope.articleTime}  阅读量:${sessionScope.article.readNum} 26 | 27 |
28 |
29 |
30 |
31 |
${sessionScope.article.message}
32 |
33 |
34 | 我要评论:
35 | 36 | 37 |
38 | 39 |
40 | 41 |
42 | 评论者:${data.name}   积分:${data.integral 43 | }  时间:${data.time }  IP:${data.ip }
44 |
${data.message}
45 |
46 |
47 |
48 | 50 | 上一页 52 | 53 | 54 |    55 | 56 | 57 | ${idx} 58 | 59 | 60 | ${idx} 62 | 63 | 64 |    65 | 66 | 67 | 69 | 下一页 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /WebRoot/jsps/article/css/article.css: -------------------------------------------------------------------------------- 1 | body { 2 | text-align: center; 3 | } 4 | /*去掉a标签下划线*/ 5 | a { 6 | text-decoration: none; 7 | } 8 | 9 | .title { 10 | margin-bottom: 10px; 11 | margin-top: 20px; 12 | font-size: 30px; 13 | } 14 | 15 | .titlespan { 16 | font-size: 20px; 17 | } 18 | 19 | #liuyan{ 20 | width: 400px; 21 | height: 150px; 22 | max-width: 400px; 23 | max-height: 150px; 24 | } 25 | -------------------------------------------------------------------------------- /WebRoot/jsps/article/js/article.js: -------------------------------------------------------------------------------- 1 | var commentUrl = path + "articleServlet"; 2 | 3 | window.onload = function() { 4 | //点击评论按钮 5 | $("#submit").click(function() { 6 | //获取评论内容 7 | var comment = $("#liuyan").val(); 8 | //判断 9 | if(comment.length==0){ 10 | alert("评论内容不能为空!"); 11 | return ; 12 | } 13 | comment=window.encodeURIComponent(comment); //解析特殊字符,防止后台无法解析 14 | var parameter ="infoId="+infoId+ "&userId=" + userId+ "&comment=" + comment + "&cmd=comment"; 15 | $.post(commentUrl, parameter, function(response) { 16 | if(response==0){//未登录 17 | window.location = path+"jsps/user/log.jsp"; 18 | }else if(response==1){ 19 | window.location = path+"articleServlet?infoId="+infoId; 20 | }else{ 21 | alert("评论失败!"); 22 | } 23 | }); 24 | }); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /WebRoot/jsps/publish/css/publish.css: -------------------------------------------------------------------------------- 1 | body{ 2 | text-align: center; 3 | } 4 | /*去掉a标签下划线*/ 5 | a{ 6 | text-decoration:none; 7 | } 8 | #title{ 9 | width: 500px; 10 | height: 20px; 11 | max-width: 500px; 12 | max-height: 20px; 13 | } 14 | #main{ 15 | width: 800px; 16 | height: 300px; 17 | max-width: 800px; 18 | max-height: 300px; 19 | } 20 | -------------------------------------------------------------------------------- /WebRoot/jsps/publish/js/publish.js: -------------------------------------------------------------------------------- 1 | var publishUrl = getRootPath_web() + "/publishServlet"; //发表文章 的链接 2 | 3 | window.onload = function() { 4 | 5 | //点击发表按钮 6 | $("#submit").click(function() { 7 | //获取文章标题,正文 8 | var title = $("#title").val(); 9 | var message = $("#main").val(); 10 | if(title.length<3){ 11 | alert("标题不能太短!"); 12 | return ; 13 | } 14 | if(message.length<15){ 15 | alert("正文不能太短!"); 16 | return ; 17 | } 18 | title = window.encodeURIComponent(title); 19 | message = window.encodeURIComponent(message); 20 | var data = "title="+title+"&message="+message+"&userId="+userId; 21 | // alert(data); 22 | $.post(publishUrl, data, function(response) { 23 | if(response == 0) { 24 | alert("发表失败!"); 25 | }else{ 26 | alert("发表成功!"); 27 | window.location=getRootPath_web()+"/articleServlet?infoId="+response;//返回到发表成功的帖子页面 28 | } 29 | }); 30 | 31 | }); 32 | 33 | } 34 | 35 | function getRootPath_web() { //http://127.0.0.1:8020/codeforum 36 | 37 | //获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp 38 | var curWwwPath = window.document.location.href; 39 | //获取主机地址之后的目录,如: uimcardprj/share/meun.jsp 40 | var pathName = window.document.location.pathname; 41 | var pos = curWwwPath.indexOf(pathName); 42 | //获取主机地址,如: http://localhost:8083 43 | var localhostPaht = curWwwPath.substring(0, pos); 44 | //获取带"/"的项目名,如:/uimcardprj 45 | var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1); 46 | return(localhostPaht + projectName); 47 | } -------------------------------------------------------------------------------- /WebRoot/jsps/publish/publish.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 3 | 4 | 5 | 6 | 发表帖子 7 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 |
19 |
20 | 标题: 21 |
22 | 27 | 正文:
28 | 29 |
30 |
31 | 32 |
33 | 34 | 35 | -------------------------------------------------------------------------------- /WebRoot/jsps/user/css/reg.css: -------------------------------------------------------------------------------- 1 | body{ 2 | text-align: center; 3 | } 4 | /*去掉a标签下划线*/ 5 | a{ 6 | text-decoration:none; 7 | } 8 | .formDiv{ 9 | margin-bottom: 10px; 10 | margin-top: 10px; 11 | } 12 | .submit,.hava,.forget{ 13 | width: 100px; 14 | height: 40px; 15 | } 16 | 17 | #submit,#hava,#forget{cursor:pointer;margin-top:25px;padding:0; background: rgba(6, 127, 228, 0.71);-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;border:0;-moz-box-shadow:0 15px 30px 0 rgba(255,255,255,.25) inset,0 2px 7px 0 rgba(0,0,0,.2);font-family:"Microsoft YaHei",Helvetica,Arial,sans-serif;font-size:14px;font-weight:700;color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.1);-o-transition:all .2s;-moz-transition:all .2s;-webkit-transition:all .2s;-ms-transition:all .2s} 18 | #submit:hover,#hava:hover,#forget:hover{-moz-box-shadow:0 15px 30px 0 rgba(255,255,255,.15) inset,0 2px 7px 0 rgba(0,0,0,.2);-webkit-box-shadow:0 15px 30px 0 rgba(255,255,255,.15) inset,0 2px 7px 0 rgba(0,0,0,.2);box-shadow:0 15px 30px 0 rgba(255,255,255,.15) inset,0 2px 7px 0 rgba(0,0,0,.2)} 19 | #submit:active,#hava:hover,#forget:hover{-moz-box-shadow:0 15px 30px 0 rgba(255,255,255,.15) inset,0 2px 7px 0 rgba(0,0,0,.2);-webkit-box-shadow:0 15px 30px 0 rgba(255,255,255,.15) inset,0 2px 7px 0 rgba(0,0,0,.2);box-shadow:0 5px 8px 0 rgba(0,0,0,.1) inset,0 1px 4px 0 rgba(0,0,0,.1);border:0 solid #016FCB} 20 | -------------------------------------------------------------------------------- /WebRoot/jsps/user/js/jquery-3.1.0.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */ 2 | !function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.0",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null!=a?a<0?this[a+this.length]:this[a]:f.call(this)},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"label"in b&&b.disabled===a||"form"in b&&b.disabled===a||"form"in b&&b.disabled===!1&&(b.isDisabled===a||b.isDisabled!==!a&&("label"in b||!ea(b))!==a)}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(_,aa),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=V.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(_,aa),$.test(j[0].type)&&qa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&sa(j),!a)return G.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||$.test(a)&&qa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){if(r.isFunction(b))return r.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return r.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(C.test(b))return r.filter(b,a,c);b=r.filter(b,a)}return r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType})}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/\S+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0, 3 | r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,ja=/^$|\/(?:java|ecma)script/i,ka={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ka.optgroup=ka.option,ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead,ka.th=ka.td;function la(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function ma(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=la(l.appendChild(f),"script"),j&&ma(g),c){k=0;while(f=g[k++])ja.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var pa=d.documentElement,qa=/^key/,ra=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,sa=/^([^.]*)(?:\.(.+)|)/;function ta(){return!0}function ua(){return!1}function va(){try{return d.activeElement}catch(a){}}function wa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)wa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ua;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(pa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c-1:r.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h\x20\t\r\n\f]*)[^>]*)\/>/gi,ya=/\s*$/g;function Ca(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Da(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ea(a){var b=Aa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c1&&"string"==typeof q&&!o.checkClone&&za.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(m&&(e=oa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(la(e,"script"),Da),i=h.length;l")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=la(h),f=la(a),d=0,e=f.length;d0&&ma(g,!i&&la(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(la(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!ya.test(a)&&!ka[(ia.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c1)}});function Xa(a,b,c,d,e){return new Xa.prototype.init(a,b,c,d,e)}r.Tween=Xa,Xa.prototype={constructor:Xa,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Xa.propHooks[this.prop];return a&&a.get?a.get(this):Xa.propHooks._default.get(this)},run:function(a){var b,c=Xa.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Xa.propHooks._default.set(this),this}},Xa.prototype.init.prototype=Xa.prototype,Xa.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Xa.propHooks.scrollTop=Xa.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Xa.prototype.init,r.fx.step={};var Ya,Za,$a=/^(?:toggle|show|hide)$/,_a=/queueHooks$/;function ab(){Za&&(a.requestAnimationFrame(ab),r.fx.tick())}function bb(){return a.setTimeout(function(){Ya=void 0}),Ya=r.now()}function cb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=aa[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function db(a,b,c){for(var d,e=(gb.tweeners[b]||[]).concat(gb.tweeners["*"]),f=0,g=e.length;f1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?hb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K); 4 | if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),hb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ib[b]||r.find.attr;ib[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=ib[g],ib[g]=e,e=null!=c(a,b,d)?g:null,ib[g]=f),e}});var jb=/^(?:input|select|textarea|button)$/i,kb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):jb.test(a.nodeName)||kb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});var lb=/[\t\r\n\f]/g;function mb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,mb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,mb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,mb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=mb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(c)+" ").replace(lb," ").indexOf(b)>-1)return!0;return!1}});var nb=/\r/g,ob=/[\x20\t\r\n\f]+/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(nb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:r.trim(r.text(a)).replace(ob," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type,g=f?null:[],h=f?e+1:d.length,i=e<0?h:f?e:0;i-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ha.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,""),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r(" 8 | 9 | 10 | 11 | 12 |

城院论坛登录

13 |
14 |
15 | 昵称: 16 | 17 |
18 |
19 | 密码: 20 |
21 |
22 | 23 |
24 |
25 | 26 | 27 |
28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /WebRoot/jsps/user/reg.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 3 | 4 | 5 | 城院论坛注册 6 | 7 | 8 | 9 | 10 | 11 | 12 |

城院论坛注册

13 |
14 |
15 | 昵称: 16 | 17 |
18 |
19 | 年龄: 20 |
21 |
22 | 职业: 23 |
24 |
25 | 爱好: 26 |
27 |
28 | 密码: 29 | 30 |
31 |
32 | 确认密码: 33 | 34 |
35 |
36 | 性别:男   37 | 女   38 |
39 |
40 | 41 |
42 |
43 | 44 | 45 |
46 |
47 | 48 | -------------------------------------------------------------------------------- /WebRoot/userLog.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 3 |

4 | 城院论坛 5 |

6 | 8 |          登录    注册 11 | 12 |           13 | 欢迎登录,${sessionScope.user.name}     发表文章 15 |    退出 16 | 17 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 说明及用法信息! 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /sql/create/1.sql: -------------------------------------------------------------------------------- 1 | /* 2 | SQLyog Ultimate v8.32 3 | MySQL - 5.7.14 : Database - codeforum 4 | ********************************************************************* 5 | */ 6 | 7 | 8 | /*!40101 SET NAMES utf8 */; 9 | 10 | /*!40101 SET SQL_MODE=''*/; 11 | 12 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 13 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 14 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 15 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 16 | CREATE DATABASE /*!32312 IF NOT EXISTS*/`codeforum` /*!40100 DEFAULT CHARACTER SET utf8 */; 17 | 18 | USE `codeforum`; 19 | 20 | /*Table structure for table `infotable` */ 21 | 22 | DROP TABLE IF EXISTS `infotable`; 23 | 24 | CREATE TABLE `infotable` ( 25 | `id` varchar(32) NOT NULL COMMENT '唯一帖子标识码', 26 | `title` varchar(100) NOT NULL COMMENT '帖子标题', 27 | `readnum` bigint(20) NOT NULL COMMENT '阅读量', 28 | `TIME` bigint(20) NOT NULL COMMENT '发帖时间', 29 | `message` varchar(4000) NOT NULL COMMENT '帖子正文', 30 | `userid` varchar(32) NOT NULL COMMENT '用户id-发表人', 31 | PRIMARY KEY (`id`), 32 | KEY `info_userId` (`userid`), 33 | CONSTRAINT `info_userId` FOREIGN KEY (`userid`) REFERENCES `usertable` (`id`) 34 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 35 | 36 | /*Data for the table `infotable` */ 37 | 38 | insert into `infotable`(`id`,`title`,`readnum`,`TIME`,`message`,`userid`) values ('1','第一篇帖子啊',641,1483441822725,'经查,夏兴华身为党的高级领导干部,纪律意识淡薄,违反中央八项规定精神,借出差之机旅游,违规打高尔夫球并由他人支付费用;违反组织纪律,不按规定报告个人有关事项,在组织函询时不如实说明问题;违反廉洁纪律,收受礼金,由下属单位和他人支付应当由个人支付的费用,明显低于市场价购买住房,谋取私利。依据《中国共产党纪律处分条例》的有关规定,经中央纪委常委会议审议并报中共中央批准,决定给予夏兴华开除党籍处分,按主任科员确定退休待遇。','1'),('2','第二篇帖子开始',481,1483441939800,'卢淳杰身为党员领导干部,理想信念丧失,严重违反党的纪律,且在党的十八大后仍不收敛、不收手,性质恶劣、情节严重。依据《中国共产党纪律处分条例》等有关规定,经省纪委常委会议审议并报省委批准,决定给予卢淳杰开除党籍处分;经省监察厅报省政府批准,决定给予其开除公职处分;收缴其违纪所得;将其涉嫌犯罪问题、线索及所涉款物移送司法机关依法处理。(广东省纪委)','1'),('3','2016年正风反腐新成就盘点:用好监督执纪“四种形态',464,1483441988658,'中央纪委数据显示,2016年已办结的77件中管干部违纪案件中,按第二和第三种形态处理的案件57件,占74%,比2015年增长90%;按第四种形态处理的案件20件,占26%,比2015年减少56.5%。“一升一降”,反映出按照“四种形态”要求,案件处理出现结构性变化。\r\n1月至11月,中央纪委处置反映中管干部问题线索中,谈话函询1305件次,比2015年同期增长96.5%。全国纪检监察机关谈话函询11.1万件次,比2015年同期增长205.8%。\r\n把纪律挺在前面,也让一些有问题的干部放下包袱。仅2016年上半年全国就有2.9万名干部主动向纪检监察机关交代问题,是2015年全年的5倍多。\r\n执纪理念不断转变:防微杜渐,把违反纪律作为审查重点\r\n从纪检监察机关工作的实际看,当前党员干部违反政治纪律的情形较为突出。有的领导干部理想信念动摇、阳奉阴违,做“两面人”;有的严重违反政治纪律,搞结党营私、团团伙伙、拉帮结派、谋取权位等政治阴谋活动;有的不相信组织,反而相信“小圈子”,相信社会上的“能人”,甚至“不信马列信鬼神”,请风水先生、江湖术士出谋划策,对抗组织审查。','2'),('4','探访四川彭山张献忠江口沉银遗址 彩钢打围安保严密',5647,1483442041415,'尽管是元旦假期,考古现场出入处均有保安值守,严防人员进入考古现场。据观察,江口沉银遗址岷江岸边的公路边张贴有多张施工通告,在挂有“江口崖墓”的入口处写有提示“考古工地预约参观”。','3'),('5','康师傅不卖方便面了”:为什么台湾人很开心?',34631,1483442131004,'甚至连富士康母公司鸿海集团也曾发布公告,将顶新集团旗下相关产品全面预防性下架,全面抵制顶新集团旗下的康师傅以及德克士炸鸡等产品。顶新魏家四兄弟中的老二魏应交曾说“我做的产品可以双手奉给我父母吃”,但魏家厨房用的却是进口橄榄油。2017年1月1日,一条“台湾康师傅解散”的消息,吓坏了不少大陆小伙伴,从小吃到大的方便面就这么没了?\r\nNO!NO!NO!彼康师傅,非此康师傅,大陆康师傅经营一切正常!\r\n据了解,台湾顶新国际集团旗下的知名品牌有:康师傅、德克士、味全、全家FamilyMart等。\r\n而这次出事的是“台湾康师傅”,为“康师傅控股”子公司,经营范围仅限台湾地区。\r\n因此,大陆业务营运不受影响!这也意味着:在大陆,你还能吃到康师傅方便面!','1'),('6','第六篇',466,1483442161739,'狄路平','2'),('7269674eab244559b194ce6c400914ad','哈哈,来试试发表文章+++',3,1483790885828,'嘿嘿,听说正文需要15个字啊,15字啊,15字。\n不知道有米有15个字了,应该差不多了吧。','1'); 39 | 40 | /*Table structure for table `replytable` */ 41 | 42 | DROP TABLE IF EXISTS `replytable`; 43 | 44 | CREATE TABLE `replytable` ( 45 | `id` varchar(32) NOT NULL COMMENT '唯一回复标识码', 46 | `TIME` bigint(18) NOT NULL COMMENT '回复时间', 47 | `message` varchar(4000) NOT NULL COMMENT '回复正文', 48 | `infoid` varchar(32) NOT NULL COMMENT '所属帖子id', 49 | `ip` varchar(32) NOT NULL COMMENT '回复者发表时ip', 50 | `userid` varchar(32) NOT NULL, 51 | PRIMARY KEY (`id`), 52 | KEY `replyId_infoId` (`infoid`), 53 | KEY `FK_replytable` (`userid`), 54 | CONSTRAINT `FK_replytable` FOREIGN KEY (`userid`) REFERENCES `usertable` (`id`), 55 | CONSTRAINT `replyId_infoId` FOREIGN KEY (`infoid`) REFERENCES `infotable` (`id`) 56 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 57 | 58 | /*Data for the table `replytable` */ 59 | 60 | insert into `replytable`(`id`,`TIME`,`message`,`infoid`,`ip`,`userid`) values ('2e5056e24c05453f9389e5b1b0cdf3e8',1483793366333,'哈哈','1','127.0.0.1','3'),('3ca0cd408e6d48edae3bf1b901cee025',1483793351389,'必须赞啊','1','127.0.0.1','3'),('54ef3d78cdd347e98a4a26ddb27e156e',1483793347094,'赞','1','127.0.0.1','3'),('6803ca2a17204fb5b2f364ab39dc4bf0',1483777815355,'赞','5','127.0.0.1','3'),('8678b3d1b3be4afd9aff879adfa57839',1483793359712,'评论','1','127.0.0.1','3'),('8a5dff65e4eb497485ca9e56d855fb23',1483793355936,'来一个','1','127.0.0.1','3'),('9b0701fb86df4e97ba591dcd590fc6d0',1483793382198,'加1','1','127.0.0.1','3'),('a92e37ead25843cda26eec0c9f32b31b',1483793341584,'好文章','1','127.0.0.1','3'),('ab51e3630cc24dcd85aa310abf93c6e6',1483777850682,'哈哈,好文章啊','5','127.0.0.1','3'); 61 | 62 | /*Table structure for table `usertable` */ 63 | 64 | DROP TABLE IF EXISTS `usertable`; 65 | 66 | CREATE TABLE `usertable` ( 67 | `id` varchar(32) NOT NULL COMMENT '用户唯一标识码', 68 | `NAME` varchar(32) NOT NULL COMMENT '昵称', 69 | `sex` varchar(32) NOT NULL COMMENT '性别', 70 | `age` varchar(32) NOT NULL COMMENT '年龄', 71 | `profession` varchar(32) NOT NULL COMMENT '职业', 72 | `love` varchar(32) NOT NULL COMMENT '爱好', 73 | `PASSWORD` varchar(32) NOT NULL COMMENT '密码', 74 | `ip` varchar(32) NOT NULL COMMENT '当前登录的IP', 75 | `integral` bigint(20) NOT NULL COMMENT '积分--注册时默认为10,发帖一次+10,回复一次+2', 76 | `TYPE` char(1) NOT NULL COMMENT '用户类型-默认注册时为1:1-普通用户,0-管理员', 77 | `solt` varchar(32) NOT NULL COMMENT '盐', 78 | PRIMARY KEY (`id`) 79 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 80 | 81 | /*Data for the table `usertable` */ 82 | 83 | insert into `usertable`(`id`,`NAME`,`sex`,`age`,`profession`,`love`,`PASSWORD`,`ip`,`integral`,`TYPE`,`solt`) values ('1','chx','1','23','学生','编程','8591bfa530427dec20b1992c63322830','127.0.0.1',10100,'1','chx'),('2','a','0','24','老师','教学','21b0304492b4e80831d66abd78514f29','127.0.0.1',500,'0','a'),('3','admin','1','43','管理','飞行','ceb4f32325eda6142bd65215f4c0f371','127.0.0.1',700,'1','admin'),('e83948f98baa44159dd2f22c09608964','陈浩翔','1','32','学生','打球','8e14ec746aa12235397236144c6f6d44','127.0.0.1',10,'0','a74e2ac5be5b4e979b0867518092b195'); 84 | 85 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 86 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 87 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 88 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 89 | -------------------------------------------------------------------------------- /src/c3p0-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 30000 5 | 30 6 | 10 7 | 30 8 | 100 9 | 10 10 | 200 11 | 12 | 10 13 | 1 14 | 0 15 | 16 | 17 | 18 | 19 | oracle.jdbc.driver.OracleDriver 20 | 21 | jdbc:oracle:thin:@127.0.0.1:1521:codeforum 22 | 23 | system 24 | 123456 25 | 2 26 | 2 27 | 2 28 | 10 29 | 50 30 | 5 31 | 32 | 33 | 34 | 35 | com.mysql.jdbc.Driver 36 | 37 | 38 | 39 | root 40 | 1234 41 | 10 42 | 20 43 | 10 44 | 100 45 | 500 46 | 5 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/cn/hncu/article/dao/ArticleDaoJdbc.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.article.dao; 2 | 3 | import static cn.hncu.utils.DataSourceUtils.getConnection; 4 | import static cn.hncu.utils.DataSourceUtils.getDataSource; 5 | 6 | import java.util.Date; 7 | import java.util.HashMap; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | import org.apache.commons.dbutils.handlers.BeanHandler; 12 | import org.apache.commons.dbutils.handlers.MapListHandler; 13 | import org.apache.commons.dbutils.handlers.ScalarHandler; 14 | import org.apache.log4j.Logger; 15 | 16 | import cn.hncu.domain.InfoAndReply; 17 | import cn.hncu.utils.IDUtils; 18 | import cn.hncu.utils.QueryRunner; 19 | 20 | public class ArticleDaoJdbc implements IArticleDao { 21 | private Logger log = Logger.getLogger(ArticleDaoJdbc.class); 22 | private final Integer pageSize = 5; 23 | 24 | /** 25 | * 实现查询帖子 26 | */ 27 | public InfoAndReply findArticle(String id) { 28 | // 先查找出帖子 29 | String sql = "SELECT id,title,readNum,TIME,message,NAME FROM infotable LEFT JOIN (SELECT id AS usersId,NAME FROM usertable) AS userstable ON infoTable.userId=userstable.usersId WHERE id=?"; 30 | QueryRunner run = new QueryRunner(getDataSource()); 31 | InfoAndReply info = run.query(sql, new BeanHandler(InfoAndReply.class), 32 | id); 33 | log.info("帖子信息为:" + info); 34 | return info; 35 | } 36 | 37 | /** 38 | * 增加1个阅读量 39 | */ 40 | public void readNumAdd(String id) { 41 | // 先找出原来的阅读量 42 | String sql = "select readNum from infotable where id=?"; 43 | QueryRunner run = new QueryRunner(getDataSource()); 44 | InfoAndReply info = run.query(sql, new BeanHandler(InfoAndReply.class), 45 | id); 46 | long readNum = info.getReadNum() + 1; 47 | sql = "update infotable set readNum =? where id=?"; 48 | log.info("id:" + id + ",readNum" + readNum); 49 | run.update(sql, readNum, id); 50 | } 51 | 52 | /** 53 | * 查找5个评论 54 | */ 55 | public Map findReplys(String id, Integer iPageNo) { 56 | 57 | Map result = new HashMap(); 58 | // 获取总页数 pageCount = rows/pageSize + ((rows%pageSize==0)?0:1) 59 | // 总行数 rows 60 | String sql = "SELECT COUNT(1) FROM replytable WHERE infoid = ?"; 61 | QueryRunner run = new QueryRunner(getDataSource()); 62 | // 总共的数据量 63 | int rows = Integer.parseInt("" 64 | + run.query(sql, new ScalarHandler(), id)); 65 | 66 | // 总页数 67 | int pageCount = rows / pageSize + ((rows % pageSize == 0) ? 0 : 1); 68 | log.info("id为:" + id + ",的总页数为:" + pageCount); 69 | result.put("pageCount", pageCount); 70 | 71 | // 分页后的当前页面内容datas 72 | // 起始行号 73 | int startN = (iPageNo - 1) * pageSize; 74 | sql = "SELECT TIME,message,ip,NAME,integral FROM (SELECT * FROM replytable WHERE infoid = ?) AS replytable2 LEFT JOIN (SELECT id AS usersId,NAME,integral FROM Usertable) AS userstable ON replytable2.userId=userstable.usersId ORDER BY replytable2.time DESC LIMIT " 75 | + startN + " , " + pageSize; 76 | List> datas = run.query(sql, new MapListHandler(), 77 | id); 78 | 79 | Integer i = 0; 80 | for (Map map : datas) { 81 | datas.get(i).put("time", 82 | IDUtils.timeToString((Long) map.get("time"))); 83 | i++; 84 | } 85 | 86 | result.put("datas", datas);// 封装到result 87 | return result; 88 | } 89 | 90 | public void reply(String infoId, String userId, String message, String ip) throws Exception{ 91 | String id = IDUtils.uuid(); 92 | long time = new Date().getTime(); 93 | String sql = "insert into `replytable`(`id`,`TIME`,`message`,`infoid`,`ip`,`userid`) values (?,?,?,?,?,?);"; 94 | QueryRunner run = new QueryRunner(); 95 | log.info("插入一个评论:" + "id=" + id + ",message:"+ message ); 96 | run.update(getConnection(),sql, id, time, message, infoId, ip, userId);//getConnection()为同一个,因为开启事务的需要 97 | 98 | // 先找出原来的阅读量 99 | sql = "select integral from usertable where id=?"; 100 | long integral = Long.parseLong(""+run.query(getConnection(),sql, new ScalarHandler(), userId)); 101 | integral = integral + 10; 102 | sql = "update usertable set integral =? where id=?"; 103 | log.info("积分增加-id:" + id + ",integral:" + integral); 104 | run.update(getConnection(),sql, integral, userId); 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /src/cn/hncu/article/dao/IArticleDao.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.article.dao; 2 | 3 | import java.util.Map; 4 | 5 | import cn.hncu.domain.InfoAndReply; 6 | import cn.hncu.domain.User; 7 | 8 | public interface IArticleDao { 9 | public InfoAndReply findArticle(String id); 10 | public void readNumAdd(String id); 11 | public Map findReplys(String id, Integer iPageNo); 12 | public void reply(String infoId, String userId, String message,String ip) throws Exception; 13 | } 14 | -------------------------------------------------------------------------------- /src/cn/hncu/article/service/ArticleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.article.service; 2 | 3 | import java.util.Map; 4 | 5 | import cn.hncu.article.dao.ArticleDaoJdbc; 6 | import cn.hncu.article.dao.IArticleDao; 7 | import cn.hncu.domain.InfoAndReply; 8 | 9 | public class ArticleServiceImpl implements IArticleService { 10 | // 声明dao 11 | private IArticleDao dao = new ArticleDaoJdbc(); 12 | 13 | public InfoAndReply findArticle(String id) { 14 | return dao.findArticle(id); 15 | } 16 | 17 | public void readNumAdd(String id) { 18 | dao.readNumAdd(id); 19 | } 20 | 21 | public Map findReplys(String id, Integer iPageNo) { 22 | return dao.findReplys(id, iPageNo); 23 | } 24 | 25 | public void reply(String infoId, String userId, String message, String ip) throws Exception{ 26 | dao.reply(infoId, userId, message, ip); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/cn/hncu/article/service/IArticleService.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.article.service; 2 | 3 | import java.util.Map; 4 | 5 | import cn.hncu.domain.InfoAndReply; 6 | import cn.hncu.utils.tx.Transaction; 7 | 8 | public interface IArticleService { 9 | /** 10 | * 查找出帖子信息 11 | * @param id 12 | * @return 13 | */ 14 | public InfoAndReply findArticle(String id); 15 | /** 16 | * 阅读量+1 17 | * @param id 18 | */ 19 | public void readNumAdd(String id); 20 | /** 21 | * 分页返回帖子的评论 22 | * @param id 23 | * @param iPageNo 24 | * @return 25 | */ 26 | public Map findReplys(String id, Integer iPageNo); 27 | /** 28 | * 用户评论帖子 29 | * @param infoId 30 | * @param userId 31 | * @param message 32 | * @param ip 33 | * @throws Exception 34 | */ 35 | @Transaction 36 | public void reply(String infoId, String userId, String message,String ip) throws Exception; 37 | } 38 | -------------------------------------------------------------------------------- /src/cn/hncu/article/servlet/ArticleServlet.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.article.servlet; 2 | 3 | import java.util.Map; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | 8 | import org.apache.log4j.Logger; 9 | 10 | import cn.hncu.article.service.ArticleServiceImpl; 11 | import cn.hncu.article.service.IArticleService; 12 | import cn.hncu.domain.InfoAndReply; 13 | import cn.hncu.utils.BaseServlet; 14 | import cn.hncu.utils.IDUtils; 15 | 16 | /** 17 | * 文章模块---显示具体文章 18 | * @author 陈浩翔 19 | * 20 | * 2017-1-5 21 | */ 22 | public class ArticleServlet extends BaseServlet{ 23 | private IArticleService service = new ArticleServiceImpl(); 24 | private Logger log = Logger.getLogger(ArticleServlet.class); 25 | 26 | @Override 27 | public void execute(HttpServletRequest req, HttpServletResponse resp) 28 | throws Exception { 29 | try { 30 | String id = req.getParameter("infoId"); 31 | 32 | log.info("帖子的ID:"+id+","+ArticleServlet.class); 33 | 34 | //帖子-标题,正文,作者,阅读量+1,id 35 | InfoAndReply article = service.findArticle(id); 36 | long time = article.getTime(); 37 | 38 | String timeStr = IDUtils.timeToString(time); 39 | 40 | req.getSession().setAttribute("articleTime", timeStr); 41 | req.getSession().setAttribute("article", article); 42 | 43 | new ReadNumThread(id).start();//阅读量加1 44 | 45 | String pageNo = req.getParameter("page"); 46 | 47 | if(pageNo==null || pageNo.trim().length()<=0){ 48 | pageNo="1"; 49 | } 50 | Integer iPageNo=1; 51 | try { 52 | iPageNo = Integer.parseInt(pageNo.trim()); 53 | } catch (NumberFormatException e) { 54 | iPageNo=1; 55 | } 56 | //分页查询评论 57 | Map replys = service.findReplys(id,iPageNo); 58 | 59 | //给结果集补一个数据:currentPage-现在的页码 60 | replys.put("currentPage", iPageNo); 61 | 62 | //将帖子评论放到session中 63 | req.getSession().setAttribute("replys",replys); 64 | 65 | String path = getInitParameter("article"); 66 | req.getRequestDispatcher(path).forward(req, resp);//转发 67 | } catch (Exception e) {//出异常了,直接转发到首页 68 | String path = getInitParameter("index"); 69 | req.getRequestDispatcher(path).forward(req, resp);//转发 70 | e.printStackTrace(); 71 | } 72 | } 73 | 74 | /** 75 | * 用户进行评论 76 | * @param req 77 | * @param resp 78 | * @throws Exception 79 | */ 80 | public void comment(HttpServletRequest req, HttpServletResponse resp) 81 | throws Exception { 82 | try { 83 | String infoId = req.getParameter("infoId");//获得帖子ID 84 | String userId = req.getParameter("userId");//获得用户ID-评论者 85 | String message = req.getParameter("comment");//评论的内容 86 | log.info("评论的内容是:"+message); 87 | //这里应该全部防范一下null 88 | if(infoId==null||userId==null||message==null){ 89 | resp.getWriter().print("-1"); 90 | return ; 91 | } 92 | 93 | String ip = req.getRemoteAddr(); 94 | new replyThread(infoId,userId,message,ip).start();//开一个线程进行评论 95 | } catch (Exception e) { 96 | //出异常了,直接返回-1 97 | resp.getWriter().print("-1"); 98 | } 99 | //直接返回1 100 | resp.getWriter().print("1"); 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /src/cn/hncu/article/servlet/ReadNumThread.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.article.servlet; 2 | 3 | import cn.hncu.article.service.ArticleServiceImpl; 4 | 5 | /** 6 | * 阅读量+1 7 | * @author 陈浩翔 8 | * 9 | * 2017-1-5 10 | */ 11 | public class ReadNumThread extends Thread{ 12 | private String id =null; 13 | public ReadNumThread() { 14 | } 15 | public ReadNumThread(String id) { 16 | this.id=id; 17 | } 18 | @Override 19 | public void run() { 20 | new ArticleServiceImpl().readNumAdd(id); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/cn/hncu/article/servlet/replyThread.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.article.servlet; 2 | 3 | import org.apache.log4j.Logger; 4 | 5 | import cn.hncu.article.service.ArticleServiceImpl; 6 | import cn.hncu.article.service.IArticleService; 7 | import cn.hncu.utils.tx.TxProxy; 8 | 9 | public class replyThread extends Thread { 10 | private String infoId = null; 11 | private String userId = null; 12 | private String message = null; 13 | private String ip = null; 14 | private IArticleService article = TxProxy.getProxy(new ArticleServiceImpl());//开启事务的支持---这里需要用同一个Connection 15 | private Logger log = Logger.getLogger(replyThread.class); 16 | 17 | public replyThread() { 18 | } 19 | 20 | public replyThread(String infoId, String userId, String message, String ip) { 21 | this.infoId = infoId; 22 | this.userId = userId; 23 | this.message = message; 24 | this.ip = ip; 25 | } 26 | 27 | @Override 28 | public void run() { 29 | try { 30 | article.reply(infoId, userId, message, ip);//这个方法上面添加了事务注解的 31 | } catch (Exception e) { 32 | log.info("出异常了,回滚事务"); 33 | e.printStackTrace(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/cn/hncu/domain/Info.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.domain; 2 | 3 | import cn.hncu.utils.BaseDomain; 4 | 5 | /** 6 | * 帖子信息 7 | * @author 陈浩翔 8 | * 2016-12-27 9 | */ 10 | public class Info extends BaseDomain{ 11 | private String title; //标题 12 | private long readNum; //阅读量 13 | private long time; // 14 | private String message; 15 | private String userId; 16 | public String getTitle() { 17 | return title; 18 | } 19 | public void setTitle(String title) { 20 | this.title = title; 21 | } 22 | public long getReadNum() { 23 | return readNum; 24 | } 25 | public void setReadNum(long readNum) { 26 | this.readNum = readNum; 27 | } 28 | public long getTime() { 29 | return time; 30 | } 31 | public void setTime(long time) { 32 | this.time = time; 33 | } 34 | public String getMessage() { 35 | return message; 36 | } 37 | public void setMessage(String message) { 38 | this.message = message; 39 | } 40 | public String getUserId() { 41 | return userId; 42 | } 43 | public void setUserId(String userId) { 44 | this.userId = userId; 45 | } 46 | @Override 47 | public String toString() { 48 | return "Info [title=" + title + ", readNum=" + readNum + ", time=" 49 | + time + ", message=" + message + ", userId=" + userId 50 | + ", getId()=" + getId() + "]"; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/cn/hncu/domain/InfoAndReply.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.domain; 2 | 3 | 4 | /** 5 | * 在单个帖子的时候需要---添加了正文和时间 6 | * @author 陈浩翔 7 | * 2017-1-5 8 | */ 9 | public class InfoAndReply { 10 | private String id; 11 | private String title; //标题 12 | private long readNum; //阅读量 13 | private long time; //发表时间 14 | private String message; 15 | private String name; 16 | 17 | public String getId() { 18 | return id; 19 | } 20 | public void setId(String id) { 21 | this.id = id; 22 | } 23 | public String getTitle() { 24 | return title; 25 | } 26 | public void setTitle(String title) { 27 | this.title = title; 28 | } 29 | public long getReadNum() { 30 | return readNum; 31 | } 32 | public void setReadNum(long readNum) { 33 | this.readNum = readNum; 34 | } 35 | public long getTime() { 36 | return time; 37 | } 38 | public void setTime(long time) { 39 | this.time = time; 40 | } 41 | public String getMessage() { 42 | return message; 43 | } 44 | public void setMessage(String message) { 45 | this.message = message; 46 | } 47 | public String getName() { 48 | return name; 49 | } 50 | public void setName(String name) { 51 | this.name = name; 52 | } 53 | @Override 54 | public String toString() { 55 | return "InfoAndReply [title=" + title + ", readNum=" + readNum 56 | + ", time=" + time + ", message=" + message + ", name=" 57 | + name + "]"; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/cn/hncu/domain/InfoMod.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.domain; 2 | 3 | import cn.hncu.utils.BaseDomain; 4 | /** 5 | * 首页进行查询时需要 6 | * @author 陈浩翔 7 | * 8 | * 2016-12-27 9 | */ 10 | public class InfoMod extends BaseDomain{ 11 | private String title; 12 | private long readNum; 13 | private String name; 14 | public String getTitle() { 15 | return title; 16 | } 17 | public void setTitle(String title) { 18 | this.title = title; 19 | } 20 | public long getReadNum() { 21 | return readNum; 22 | } 23 | public void setReadNum(long readNum) { 24 | this.readNum = readNum; 25 | } 26 | public String getName() { 27 | return name; 28 | } 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | @Override 33 | public String toString() { 34 | return "InfoMod [title=" + title + ", readNum=" + readNum 35 | + ", name=" + name + ", getId()=" 36 | + getId() + "]"; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/cn/hncu/domain/Reply.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.domain; 2 | 3 | import cn.hncu.utils.BaseDomain; 4 | 5 | /** 6 | * 回复信息 7 | * @author 陈浩翔 8 | * 9 | * 2016-12-27 10 | */ 11 | public class Reply extends BaseDomain{ 12 | private long time; 13 | private String message; 14 | private String infoId; 15 | private String ip; 16 | private String userId; 17 | 18 | public long getTime() { 19 | return time; 20 | } 21 | public void setTime(long time) { 22 | this.time = time; 23 | } 24 | public String getMessage() { 25 | return message; 26 | } 27 | public void setMessage(String message) { 28 | this.message = message; 29 | } 30 | public String getInfoId() { 31 | return infoId; 32 | } 33 | public void setInfoId(String infoId) { 34 | this.infoId = infoId; 35 | } 36 | public String getIp() { 37 | return ip; 38 | } 39 | public void setIp(String ip) { 40 | this.ip = ip; 41 | } 42 | 43 | public String getUserId() { 44 | return userId; 45 | } 46 | public void setUserId(String userId) { 47 | this.userId = userId; 48 | } 49 | @Override 50 | public String toString() { 51 | return "Reply [time=" + time + ", message=" + message + ", infoId=" 52 | + infoId + ", ip=" + ip + ", userId=" + userId + "]"; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/cn/hncu/domain/User.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.domain; 2 | 3 | import cn.hncu.utils.BaseDomain; 4 | 5 | /** 6 | * @author 陈浩翔 7 | * 2016-12-27 8 | */ 9 | public class User extends BaseDomain{ 10 | private String name; 11 | private String sex;//性别 12 | private String age; 13 | private String profession;//职业 14 | private String love; 15 | private String password; 16 | private String ip; 17 | private long integral;//积分--注册时默认为10,发帖一次+10,回复一次+2 18 | private String type;//用户类型-默认注册时为1:1-普通用户,0-管理员 19 | private String solt;//加密用的盐 20 | 21 | public String getName() { 22 | return name; 23 | } 24 | public void setName(String name) { 25 | this.name = name; 26 | } 27 | public String getSex() { 28 | return sex; 29 | } 30 | public void setSex(String sex) { 31 | this.sex = sex; 32 | } 33 | public String getAge() { 34 | return age; 35 | } 36 | public void setAge(String age) { 37 | this.age = age; 38 | } 39 | public String getProfession() { 40 | return profession; 41 | } 42 | public void setProfession(String profession) { 43 | this.profession = profession; 44 | } 45 | public String getLove() { 46 | return love; 47 | } 48 | public void setLove(String love) { 49 | this.love = love; 50 | } 51 | public String getPassword() { 52 | return password; 53 | } 54 | public void setPassword(String password) { 55 | this.password = password; 56 | } 57 | public String getIp() { 58 | return ip; 59 | } 60 | public void setIp(String ip) { 61 | this.ip = ip; 62 | } 63 | public long getIntegral() { 64 | return integral; 65 | } 66 | public void setIntegral(long integral) { 67 | this.integral = integral; 68 | } 69 | public String getType() { 70 | return type; 71 | } 72 | public void setType(String type) { 73 | this.type = type; 74 | } 75 | public String getSolt() { 76 | return solt; 77 | } 78 | public void setSolt(String solt) { 79 | this.solt = solt; 80 | } 81 | @Override 82 | public String toString() { 83 | return "User [name=" + name + ", sex=" + sex + ", age=" + age 84 | + ", profession=" + profession + ", love=" + love 85 | + ", password=" + password + ", ip=" + ip + ", integral=" 86 | + integral + ", type=" + type + ", solt=" + solt + ", getId()=" 87 | + getId() + "]"; 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/cn/hncu/filter/AdminLoginFilter.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.filter; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.Filter; 6 | import javax.servlet.FilterChain; 7 | import javax.servlet.FilterConfig; 8 | import javax.servlet.ServletException; 9 | import javax.servlet.ServletRequest; 10 | import javax.servlet.ServletResponse; 11 | import javax.servlet.http.HttpServletRequest; 12 | public class AdminLoginFilter implements Filter { 13 | private FilterConfig conf; 14 | public void init(FilterConfig filterConfig) throws ServletException { 15 | this.conf = filterConfig; 16 | } 17 | public void doFilter(ServletRequest request, ServletResponse response, 18 | FilterChain chain) throws IOException, ServletException { 19 | //验证在session中是否存在admin这个key 20 | HttpServletRequest req = (HttpServletRequest) request; 21 | if(req.getSession().getAttribute("admin")==null){ 22 | String loginPage = conf.getInitParameter("loginPage"); 23 | req.getRequestDispatcher(loginPage).forward(request, response); 24 | }else{ 25 | chain.doFilter(request, response); 26 | } 27 | } 28 | public void destroy() { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/cn/hncu/filter/CharFilter.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.filter; 2 | import java.io.IOException; 3 | import javax.servlet.Filter; 4 | import javax.servlet.FilterChain; 5 | import javax.servlet.FilterConfig; 6 | import javax.servlet.ServletException; 7 | import javax.servlet.ServletRequest; 8 | import javax.servlet.ServletResponse; 9 | public class CharFilter implements Filter { 10 | public void init(FilterConfig filterConfig) throws ServletException { 11 | } 12 | public void doFilter(ServletRequest request, ServletResponse response, 13 | FilterChain chain) throws IOException, ServletException { 14 | request.setCharacterEncoding("UTF-8"); 15 | response.setContentType("text/html;charset=UTF-8"); 16 | chain.doFilter(request, response); 17 | } 18 | public void destroy() { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/cn/hncu/filter/UserLoginFilter.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.filter; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.Filter; 6 | import javax.servlet.FilterChain; 7 | import javax.servlet.FilterConfig; 8 | import javax.servlet.ServletException; 9 | import javax.servlet.ServletRequest; 10 | import javax.servlet.ServletResponse; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | 14 | import org.apache.log4j.Logger; 15 | /** 16 | * 用户登录拦截器 17 | * @author 陈浩翔 18 | * 2016-12-27 19 | */ 20 | public class UserLoginFilter implements Filter{ 21 | private Logger log = Logger.getLogger(UserLoginFilter.class); 22 | private FilterConfig conf; 23 | public void init(FilterConfig filterConfig) throws ServletException { 24 | this.conf=filterConfig; 25 | } 26 | public void doFilter(ServletRequest request, ServletResponse response, 27 | FilterChain chain) throws IOException, ServletException { 28 | //验证用户是否已经登录 29 | HttpServletRequest req = (HttpServletRequest) request; 30 | 31 | //评论时: 32 | if(req.getParameter("cmd")!=null&&req.getParameter("cmd").equals("comment")&&req.getSession().getAttribute("user")==null){ 33 | String loginPath = conf.getInitParameter("loginPage"); 34 | log.info("未登录时想评论被拦截!"); 35 | //返回到登录页面 36 | // HttpServletResponse resp = (HttpServletResponse) response; 37 | // resp.sendRedirect(loginPath); 38 | String nativeInfoId = req.getParameter("infoId"); 39 | req.getSession().setAttribute("nativeInfoId", nativeInfoId); 40 | // req.getRequestDispatcher(loginPath).forward(request, response);//转发 41 | response.getWriter().print("0"); 42 | 43 | }else{ 44 | chain.doFilter(request, response);//放行 45 | } 46 | } 47 | public void destroy() { 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/cn/hncu/index/dao/IIndexDao.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.index.dao; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import cn.hncu.domain.InfoMod; 7 | 8 | public interface IIndexDao { 9 | public List hot(); 10 | public Map all(Integer iPageNo); 11 | } 12 | -------------------------------------------------------------------------------- /src/cn/hncu/index/dao/IndexDaoJdbc.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.index.dao; 2 | 3 | import static cn.hncu.utils.DataSourceUtils.getDataSource; 4 | 5 | import java.util.HashMap; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import org.apache.commons.dbutils.handlers.BeanListHandler; 10 | import org.apache.commons.dbutils.handlers.MapListHandler; 11 | import org.apache.commons.dbutils.handlers.ScalarHandler; 12 | import org.apache.log4j.Logger; 13 | 14 | import cn.hncu.domain.InfoMod; 15 | import cn.hncu.utils.QueryRunner; 16 | 17 | public class IndexDaoJdbc implements IIndexDao { 18 | 19 | private Logger log = Logger.getLogger(IndexDaoJdbc.class); 20 | private final Integer pageSize = 5;// 每页显示 21 | 22 | /** 23 | * 返回5篇热门帖子 24 | */ 25 | public List hot() { 26 | String sql = "SELECT id,title,readNum,NAME FROM infoTable LEFT JOIN (SELECT id AS usersId,NAME FROM usertable) AS userstable ON infoTable.userId=userstable.usersId ORDER BY infoTable.readNum DESC LIMIT 5";// 降序 27 | QueryRunner run = new QueryRunner(getDataSource()); 28 | List infos = run.query(sql, new BeanListHandler( 29 | InfoMod.class)); 30 | return infos; 31 | } 32 | 33 | /** 34 | * 返回所有帖子 35 | */ 36 | public Map all(Integer iPageNo) { 37 | Map result = new HashMap(); 38 | // 获取总页数 pageCount = rows/pageSize + ((rows%pageSize==0)?0:1) 39 | // 总行数 rows 40 | String sql = "select count(1) from infoTable"; 41 | QueryRunner run = new QueryRunner(getDataSource()); 42 | int rows = Integer.parseInt("" + run.query(sql, new ScalarHandler())); 43 | // 总页数 44 | int pageCount = rows / pageSize + ((rows % pageSize == 0) ? 0 : 1); 45 | log.info("所有帖子的总页数为:"+pageCount); 46 | result.put("pageCount", pageCount); 47 | 48 | // 分页后的当前页面内容datas 49 | // 起始行号 50 | int startN = (iPageNo - 1) * pageSize; 51 | sql = "SELECT id,title,readNum,NAME FROM infoTable LEFT JOIN (SELECT id AS usersId,NAME FROM Usertable) AS userstable ON infoTable.userId=userstable.usersId ORDER BY infoTable.time desc limit " 52 | + startN + " , " + pageSize; 53 | List> datas = run.query(sql, new MapListHandler()); 54 | result.put("datas", datas);// 封装到result 55 | 56 | return result; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/cn/hncu/index/service/IIndexService.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.index.service; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import cn.hncu.domain.InfoMod; 7 | 8 | public interface IIndexService { 9 | public List hot(); 10 | public Map all(Integer iPageNo); 11 | } 12 | -------------------------------------------------------------------------------- /src/cn/hncu/index/service/IndexServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.index.service; 2 | import java.util.List; 3 | import java.util.Map; 4 | 5 | import cn.hncu.domain.InfoMod; 6 | import cn.hncu.index.dao.IIndexDao; 7 | import cn.hncu.index.dao.IndexDaoJdbc; 8 | 9 | public class IndexServiceImpl implements IIndexService{ 10 | //声明dao 11 | private IIndexDao dao = new IndexDaoJdbc(); 12 | 13 | public List hot() { 14 | return dao.hot(); 15 | } 16 | public Map all(Integer iPageNo) { 17 | return dao.all(iPageNo); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/cn/hncu/index/servlet/IndexServlet.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.index.servlet; 2 | import java.util.List; 3 | import java.util.Map; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | 8 | import org.apache.log4j.Logger; 9 | 10 | import cn.hncu.domain.InfoMod; 11 | import cn.hncu.index.service.IIndexService; 12 | import cn.hncu.index.service.IndexServiceImpl; 13 | import cn.hncu.utils.BaseServlet; 14 | /** 15 | * 主页模块 16 | * @author 陈浩翔 17 | * 2016-12-27 18 | */ 19 | public class IndexServlet extends BaseServlet { 20 | private Logger log = Logger.getLogger(IndexServlet.class); 21 | private static final long serialVersionUID = 1L; 22 | //声明 23 | private IIndexService service = new IndexServiceImpl(); 24 | //默认 25 | @Override 26 | public void execute(HttpServletRequest req, HttpServletResponse resp) 27 | throws Exception { 28 | try { 29 | String pageNo = req.getParameter("page"); 30 | if(pageNo==null || pageNo.trim().length()<=0){ 31 | pageNo="1"; 32 | } 33 | Integer iPageNo=1; 34 | try { 35 | iPageNo = Integer.parseInt(pageNo); 36 | } catch (NumberFormatException e) { 37 | iPageNo=1; 38 | } 39 | //查询5个热门帖子 40 | List infoHots = service.hot(); 41 | 42 | //分页查询 43 | Map infoAlls = service.all(iPageNo); 44 | //给结果集补一个数据:currentPage-现在的页码 45 | infoAlls.put("currentPage", iPageNo); 46 | 47 | //将热门帖子信息放到session中 48 | req.getSession().setAttribute("infoHots",infoHots); 49 | //将所有帖子信息放到session中 50 | req.getSession().setAttribute("infoAlls",infoAlls); 51 | 52 | String path = getInitParameter("index"); 53 | req.getRequestDispatcher(path).forward(req, resp); 54 | } catch (Exception e) { 55 | String path = getInitParameter("index"); 56 | req.getRequestDispatcher(path).forward(req, resp); 57 | e.printStackTrace(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/cn/hncu/publish/dao/IPublishDao.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.publish.dao; 2 | 3 | import cn.hncu.domain.Info; 4 | 5 | public interface IPublishDao { 6 | public String publish(Info info); 7 | } 8 | -------------------------------------------------------------------------------- /src/cn/hncu/publish/dao/PublishDaoJdbc.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.publish.dao; 2 | 3 | import static cn.hncu.utils.DataSourceUtils.getConnection; 4 | 5 | import org.apache.commons.dbutils.handlers.ScalarHandler; 6 | import org.apache.log4j.Logger; 7 | 8 | import cn.hncu.domain.Info; 9 | import cn.hncu.utils.QueryRunner; 10 | 11 | public class PublishDaoJdbc implements IPublishDao { 12 | private Logger log = Logger.getLogger(PublishDaoJdbc.class); 13 | 14 | private final Integer integral = 50; //一篇新文章加50积分 15 | 16 | public String publish(Info info) { 17 | String sql = "insert into infotable(id,title,readnum,TIME,message,userid) values(?,?,?,?,?,?)"; 18 | log.info("新文章info的数据为:"+info); 19 | //声明Runner 20 | QueryRunner run = new QueryRunner(); 21 | run.update(getConnection(),sql,info.getId(),info.getTitle(),info.getReadNum(), 22 | info.getTime(),info.getMessage(),info.getUserId()); 23 | //新增文章之后,给用户加积分 24 | 25 | sql = "select integral from usertable where id=?"; 26 | long i = Long.parseLong(""+run.query(getConnection(),sql, new ScalarHandler(), info.getUserId())); 27 | i = i+integral; 28 | 29 | //修改积分 30 | sql = "update usertable set integral =? where id=?"; 31 | run.update(getConnection(),sql, i, info.getUserId()); 32 | 33 | return info.getId(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/cn/hncu/publish/service/IPublishService.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.publish.service; 2 | 3 | import cn.hncu.domain.Info; 4 | import cn.hncu.utils.tx.Transaction; 5 | 6 | public interface IPublishService { 7 | @Transaction 8 | public String publish(Info info); 9 | } 10 | -------------------------------------------------------------------------------- /src/cn/hncu/publish/service/PublishServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.publish.service; 2 | import java.util.List; 3 | import java.util.Map; 4 | 5 | import cn.hncu.domain.Info; 6 | import cn.hncu.domain.InfoMod; 7 | import cn.hncu.index.dao.IIndexDao; 8 | import cn.hncu.index.dao.IndexDaoJdbc; 9 | import cn.hncu.publish.dao.IPublishDao; 10 | import cn.hncu.publish.dao.PublishDaoJdbc; 11 | 12 | public class PublishServiceImpl implements IPublishService{ 13 | //声明dao 14 | private IPublishDao dao = new PublishDaoJdbc(); 15 | public String publish(Info info) { 16 | return dao.publish(info); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/cn/hncu/publish/servlet/PublishServlet.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.publish.servlet; 2 | 3 | import java.io.PrintWriter; 4 | import java.util.Date; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | import cn.hncu.domain.Info; 10 | import cn.hncu.publish.service.IPublishService; 11 | import cn.hncu.publish.service.PublishServiceImpl; 12 | import cn.hncu.utils.BaseServlet; 13 | import cn.hncu.utils.IDUtils; 14 | import cn.hncu.utils.tx.TxProxy; 15 | /** 16 | * 用户发表文章的servlet 17 | * @author 陈浩翔 18 | * 19 | * 2017-1-7 20 | */ 21 | public class PublishServlet extends BaseServlet{ 22 | private IPublishService service = TxProxy.getProxy(new PublishServiceImpl()); //事务处理 23 | 24 | @Override 25 | public void execute(HttpServletRequest req, HttpServletResponse resp) 26 | throws Exception { 27 | PrintWriter out= resp.getWriter(); 28 | try { 29 | String userId = req.getParameter("userId"); 30 | String title = req.getParameter("title"); 31 | String message = req.getParameter("message"); 32 | 33 | if(userId==null||title==null||message==null){ 34 | out.print(0);//出错 35 | return ; 36 | } 37 | 38 | Info info = new Info(); 39 | info.setId(IDUtils.uuid()); 40 | info.setMessage(message); 41 | info.setReadNum(0); 42 | info.setTime(new Date().getTime()); 43 | info.setTitle(title); 44 | info.setUserId(userId); 45 | 46 | String infoId = service.publish(info); 47 | if(infoId==null){ 48 | out.print(0); 49 | }else{ 50 | out.print(infoId); 51 | } 52 | } catch (Exception e) { 53 | out.print(0); 54 | e.printStackTrace(); 55 | } 56 | 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/cn/hncu/test/TestConn.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.test; 2 | 3 | import java.sql.Connection; 4 | import java.sql.SQLException; 5 | 6 | import org.junit.Test; 7 | 8 | import cn.hncu.utils.DataSourceUtils; 9 | 10 | public class TestConn { 11 | @Test 12 | public void test() throws Exception{ 13 | for(int i=0;i<20;i++){ 14 | final int a=i; 15 | new Thread(){ 16 | public void run() { 17 | Connection con = DataSourceUtils.getConnection(); 18 | System.err.println(a+":"+con); 19 | try { 20 | con.close(); 21 | } catch (SQLException e) { 22 | e.printStackTrace(); 23 | } 24 | }; 25 | }.start(); 26 | } 27 | System.in.read(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/cn/hncu/user/dao/IUserDao.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.user.dao; 2 | 3 | import cn.hncu.domain.User; 4 | 5 | public interface IUserDao { 6 | public Integer reg(User user); 7 | public Integer val(String name); 8 | public User login(String name,String pwd); 9 | public void saveIp(String name,String ip); 10 | } 11 | -------------------------------------------------------------------------------- /src/cn/hncu/user/dao/UserDaoJdbc.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.user.dao; 2 | 3 | import org.apache.commons.dbutils.handlers.BeanHandler; 4 | import org.apache.commons.dbutils.handlers.ScalarHandler; 5 | import org.apache.log4j.Logger; 6 | 7 | import cn.hncu.domain.User; 8 | import cn.hncu.user.servlet.UserServlet; 9 | import cn.hncu.utils.IDUtils; 10 | import cn.hncu.utils.PasswordUtils; 11 | import cn.hncu.utils.QueryRunner; 12 | import static cn.hncu.utils.DataSourceUtils.*; 13 | 14 | public class UserDaoJdbc implements IUserDao{ 15 | private Logger log = Logger.getLogger(UserDaoJdbc.class); 16 | 17 | /** 18 | * 实现用户注册 19 | */ 20 | public Integer reg(User user) { 21 | String sql = "insert into userTable(id,name,sex,age,profession,love,password,ip,integral,type,solt) values(?,?,?,?,?,?,?,?,?,?,?)"; 22 | user.setId(IDUtils.uuid()); 23 | user.setSolt(PasswordUtils.getSolt()); 24 | user.setPassword(PasswordUtils.md5(user.getPassword().trim(), user.getSolt().trim())); 25 | log.debug("此时user的数据为:"+user); 26 | //声明Runner 27 | QueryRunner run = new QueryRunner(getDataSource()); 28 | Object obj = run.update(sql,user.getId(),user.getName().trim(),user.getSex().trim(),user.getAge().trim(),user.getProfession().trim() 29 | ,user.getLove().trim(),user.getPassword().trim(),user.getIp().trim(),user.getIntegral(),user.getType().trim(),user.getSolt().trim()); 30 | log.info("用户注册后,数据库的返回信息:"+obj); 31 | return Integer.parseInt(""+obj); 32 | } 33 | 34 | /** 35 | * 用户名是否存在 36 | */ 37 | public Integer val(String name){ 38 | //查询是否拥有此用户名 39 | String sql = "select count(1) from userTable where name=?"; 40 | QueryRunner run = new QueryRunner(getDataSource()); 41 | Object obj = run.query(sql,new ScalarHandler(),name);//一行一列 42 | log.info("查询数据库用户名是否存在返回:"+obj); 43 | return Integer.parseInt(""+obj); 44 | } 45 | 46 | /** 47 | * 用户登录功能 48 | */ 49 | public User login(String name,String pwd){ 50 | //根据用户名查询出用户 51 | String sql = "select * from userTable where name=?"; 52 | QueryRunner run = new QueryRunner(getDataSource()); 53 | User user = run.query(sql,new BeanHandler(User.class),name); 54 | //获得盐 55 | if(user==null){ 56 | return null; 57 | } 58 | String solt = user.getSolt(); 59 | String userPwd = PasswordUtils.md5(pwd, solt); 60 | if(userPwd.equals(user.getPassword())){//对密码加密后比较 61 | return user; 62 | }else{ 63 | return null; 64 | } 65 | } 66 | 67 | public void saveIp(String name, String ip) { 68 | String sql = "update userTable set ip =? where name=?"; 69 | log.info("修改"+name+"的ip为:"+ip); 70 | QueryRunner run = new QueryRunner(getDataSource()); 71 | run.update(sql, ip,name); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/cn/hncu/user/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.user.service; 2 | 3 | import cn.hncu.domain.User; 4 | 5 | public interface IUserService { 6 | public Integer reg(User u); 7 | public Integer val(String name); 8 | public User login(String name,String pwd); 9 | public void saveIp(String name,String ip); 10 | } 11 | -------------------------------------------------------------------------------- /src/cn/hncu/user/service/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.user.service; 2 | import cn.hncu.domain.User; 3 | import cn.hncu.user.dao.IUserDao; 4 | import cn.hncu.user.dao.UserDaoJdbc; 5 | 6 | public class UserServiceImpl implements IUserService{ 7 | //声明dao 8 | private IUserDao dao = new UserDaoJdbc(); 9 | public Integer reg(User u) { 10 | return dao.reg(u); 11 | } 12 | public Integer val(String name){ 13 | return dao.val(name); 14 | } 15 | public User login(String name,String pwd){ 16 | return dao.login(name,pwd); 17 | } 18 | public void saveIp(String name,String ip){ 19 | dao.saveIp(name, ip); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/cn/hncu/user/servlet/IPThread.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.user.servlet; 2 | 3 | import cn.hncu.user.service.UserServiceImpl; 4 | 5 | public class IPThread extends Thread{ 6 | private String name =null; 7 | private String ip = null; 8 | 9 | public IPThread() { 10 | } 11 | 12 | public IPThread(String name, String ip) { 13 | this.name=name; 14 | this.ip=ip; 15 | } 16 | 17 | @Override 18 | public void run() { 19 | new UserServiceImpl().saveIp(name, ip); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/cn/hncu/user/servlet/UserServlet.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.user.servlet; 2 | 3 | import java.io.PrintWriter; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | 8 | import org.apache.log4j.Logger; 9 | 10 | import cn.hncu.domain.User; 11 | import cn.hncu.user.service.IUserService; 12 | import cn.hncu.user.service.UserServiceImpl; 13 | import cn.hncu.utils.BaseServlet; 14 | import cn.hncu.utils.BeanUtils; 15 | 16 | /** 17 | * 用户登录注册模块 18 | * 19 | * @author 陈浩翔 2016-12-27 20 | */ 21 | public class UserServlet extends BaseServlet { 22 | private Logger log = Logger.getLogger(UserServlet.class); 23 | private static final long serialVersionUID = 1L; 24 | // 声明 25 | private IUserService service = new UserServiceImpl(); 26 | 27 | // 默认转到注册页面 28 | @Override 29 | public void execute(HttpServletRequest req, HttpServletResponse resp) 30 | throws Exception { 31 | String path = getInitParameter("reg"); 32 | req.getRequestDispatcher(path).forward(req, resp);//转发 33 | } 34 | 35 | /** 36 | * 用户注册功能 37 | */ 38 | public void reg(HttpServletRequest req, HttpServletResponse resp) 39 | throws Exception { 40 | System.out.println("进入注册..."); 41 | User user = BeanUtils.populate(User.class, req.getParameterMap()); 42 | user.setIp(req.getRemoteAddr()); 43 | user.setType("0"); 44 | user.setIntegral(10); 45 | log.debug("用户注册信息为:" + user.toString() + "----即将进入service模块"); 46 | PrintWriter out = resp.getWriter(); 47 | if (service.reg(user) == 1) { 48 | out.print("1"); 49 | } else { 50 | out.print("0"); 51 | } 52 | 53 | } 54 | 55 | /** 56 | * 验证用户名是否存在 57 | */ 58 | public void val(HttpServletRequest req, HttpServletResponse resp) 59 | throws Exception { 60 | String name = req.getParameter("name");// 接收用户名 61 | log.debug("接收到用户名:" + name); 62 | PrintWriter out = resp.getWriter(); 63 | int msg = service.val(name); 64 | if (msg == 1) { 65 | out.print("userNameRepeat"); 66 | } else { 67 | out.print("userNameOk");// 用户名可以用 68 | } 69 | } 70 | 71 | /** 72 | * 用户登录功能 73 | */ 74 | public void log(HttpServletRequest req, HttpServletResponse resp) 75 | throws Exception { 76 | String result = "0";// 返回值 77 | String name = req.getParameter("name");// 接收用户名 78 | String password = req.getParameter("password");//接收密码 79 | User user = service.login(name,password); 80 | log.info("返回的user是:" + user); 81 | 82 | if (user == null) { // 登录不成功 83 | result = "-1"; 84 | } else {// 登录成功 85 | result = "0"; 86 | // 将用户信息放到session中 87 | req.getSession().setAttribute("user", user); 88 | //存储用户的ip---新开一个线程来存储 89 | String ip = req.getRemoteAddr(); 90 | new IPThread(user.getName(),ip).start(); 91 | String nativeInfoId = (String) req.getSession().getAttribute("nativeInfoId"); 92 | if(nativeInfoId!=null&&!nativeInfoId.equals("")){ 93 | req.getSession().setAttribute("nativeInfoId", null); 94 | result = nativeInfoId;//登录成功,且返回原来的帖子页面 95 | } 96 | // String articlePath = getInitParameter("article"); 97 | // resp.sendRedirect(articlePath+"?infoId="+nativeInfoId);//重定向 98 | } 99 | PrintWriter out = resp.getWriter(); 100 | out.print(result); 101 | } 102 | 103 | /** 104 | * 用户退出功能 105 | */ 106 | public void out(HttpServletRequest req, HttpServletResponse resp) 107 | throws Exception { 108 | req.getSession().setAttribute("user", null); 109 | String path = getInitParameter("index"); 110 | resp.sendRedirect(path);//重定向 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/cn/hncu/utils/BaseDomain.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.utils; 2 | 3 | /** 4 | * @author 陈浩翔 5 | * 6 | * 2016-12-27 7 | */ 8 | public class BaseDomain { 9 | private String id; 10 | 11 | public String getId() { 12 | return id; 13 | } 14 | 15 | public void setId(String id) { 16 | this.id = id; 17 | } 18 | 19 | @Override 20 | public int hashCode() { 21 | final int prime = 31; 22 | int result = 1; 23 | result = prime * result + ((id == null) ? 0 : id.hashCode()); 24 | return result; 25 | } 26 | 27 | @Override 28 | public boolean equals(Object obj) { 29 | if (this == obj) 30 | return true; 31 | if (obj == null) 32 | return false; 33 | if (getClass() != obj.getClass()) 34 | return false; 35 | BaseDomain other = (BaseDomain) obj; 36 | if (id == null) { 37 | if (other.id != null) 38 | return false; 39 | } else if (!id.equals(other.id)) 40 | return false; 41 | return true; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "BaseDomain [id=" + id + "]"; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/cn/hncu/utils/BaseServlet.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.utils; 2 | import java.io.IOException; 3 | import java.io.UnsupportedEncodingException; 4 | import java.lang.reflect.InvocationTargetException; 5 | import java.lang.reflect.Method; 6 | import java.util.Iterator; 7 | import java.util.Map; 8 | import javax.servlet.ServletException; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletRequestWrapper; 12 | import javax.servlet.http.HttpServletResponse; 13 | 14 | import org.apache.log4j.Logger; 15 | /** 16 | * 基类, 1:修改HttpServletRequest增强 2:动态调用用户指定的方法?cmd=save....,默认为execute方法 17 | * @author 陈浩翔 18 | * 19 | * 2017-1-5 20 | */ 21 | public abstract class BaseServlet extends HttpServlet { 22 | private Logger log = Logger.getLogger(BaseServlet.class); 23 | private static final long serialVersionUID = 1L; 24 | @Override 25 | public void doGet(HttpServletRequest req, HttpServletResponse resp) 26 | throws ServletException, IOException { 27 | doPost(req, resp); 28 | } 29 | @Override 30 | public void doPost(HttpServletRequest req, HttpServletResponse resp) 31 | throws ServletException, IOException { 32 | String cmd = req.getParameter("cmd"); 33 | if (null == cmd || cmd.trim().equals("")) { 34 | cmd = "execute"; 35 | } 36 | log.debug("调用的方法为:"+cmd); 37 | try { 38 | Method method = this.getClass().getMethod(cmd, 39 | HttpServletRequest.class, HttpServletResponse.class); 40 | method.invoke(this, req, resp); 41 | } catch (NoSuchMethodException e) { 42 | throw new RuntimeException("没有此方法:" + e.getMessage(), e); 43 | }catch(InvocationTargetException e){ 44 | throw new RuntimeException("目标方法执行失败:" + e.getMessage(), e); 45 | }catch(IllegalAccessException e){ 46 | throw new RuntimeException("你可能访问了一个私有的方法:" + e.getMessage(), e); 47 | }catch(Exception e){ 48 | throw new RuntimeException(e.getMessage(), e); 49 | } 50 | } 51 | public abstract void execute(HttpServletRequest req, 52 | HttpServletResponse resp) throws Exception; 53 | } 54 | -------------------------------------------------------------------------------- /src/cn/hncu/utils/BeanUtils.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.utils; 2 | import java.util.Map; 3 | /** 4 | * @author 陈浩翔 5 | * 6 | * 2017-1-5 7 | */ 8 | public class BeanUtils { 9 | public static T populate(T t,Map map){ 10 | try{ 11 | org.apache.commons.beanutils.BeanUtils.populate(t,map); 12 | return t; 13 | }catch(Exception e){ 14 | throw new RuntimeException(e.getMessage(),e); 15 | } 16 | } 17 | public static T populate(Class cls,Map map){ 18 | try{ 19 | T t = cls.newInstance(); 20 | return populate(t, map); 21 | }catch(Exception e){ 22 | throw new RuntimeException(e.getMessage(),e); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/cn/hncu/utils/DataSourceUtils.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.utils; 2 | import java.sql.Connection; 3 | import java.sql.SQLException; 4 | import javax.sql.DataSource; 5 | import org.apache.log4j.Logger; 6 | import com.mchange.v2.c3p0.ComboPooledDataSource; 7 | /** 8 | * @author 陈浩翔 9 | * 2016-12-27 10 | */ 11 | public class DataSourceUtils { 12 | private static Logger log = Logger.getLogger(DataSourceUtils.class); 13 | private static DataSource ds; 14 | private static ThreadLocal tl = new ThreadLocal(); 15 | static{ 16 | try{ 17 | ds = new ComboPooledDataSource("mySql"); 18 | }catch(Exception e){ 19 | throw new RuntimeException(e.getMessage(),e); 20 | } 21 | } 22 | public static DataSource getDataSource(){ 23 | return ds; 24 | } 25 | public static Connection getConnection(){ 26 | Connection con = tl.get(); 27 | if(con==null){ 28 | try { 29 | con = ds.getConnection(); 30 | log.info("没有连接对象,返回一个新的..."); 31 | } catch (SQLException e) { 32 | throw new RuntimeException("获取连接时出错"+e.getMessage(),e); 33 | } 34 | tl.set(con); 35 | } 36 | return con; 37 | } 38 | public static void remove(){ 39 | tl.remove(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/cn/hncu/utils/EnhanceBaseServlet.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.utils; 2 | import java.io.IOException; 3 | import java.io.UnsupportedEncodingException; 4 | import java.lang.reflect.Method; 5 | import java.util.Iterator; 6 | import java.util.Map; 7 | 8 | import javax.servlet.ServletException; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletRequestWrapper; 12 | import javax.servlet.http.HttpServletResponse; 13 | 14 | /** 15 | * 基类, 1:修改HttpServletRequest增强 2:动态调用用户指定的方法?cmd=save....,默认为execute方法 16 | * @author 陈浩翔 17 | * 18 | * 2016-12-27 19 | */ 20 | public abstract class EnhanceBaseServlet extends HttpServlet { 21 | @Override 22 | public void doGet(HttpServletRequest req, HttpServletResponse resp) 23 | throws ServletException, IOException { 24 | doPost(req, resp); 25 | } 26 | 27 | @Override 28 | public void doPost(HttpServletRequest req, HttpServletResponse resp) 29 | throws ServletException, IOException { 30 | String cmd = req.getParameter("cmd"); // 获取调用方法的参数 31 | if (null == cmd || cmd.trim().equals("")) { 32 | cmd = "execute"; 33 | } 34 | try { 35 | // 通过反射调用子类的方法,接收获取子类的什么方法,且子类的方法必须要接收两个参数 36 | Method method = this.getClass().getMethod(cmd, 37 | HttpServletRequest.class, HttpServletResponse.class); 38 | // 声明自己的包装类 39 | MyRequest request = new MyRequest(req); 40 | // 调用子类方法 41 | method.invoke(this, request, resp); 42 | } catch (Exception e) { 43 | throw new RuntimeException("没有此方法" + e.getMessage(), e); 44 | } 45 | } 46 | 47 | /** 48 | * 默认用户必须要书写exeucte方法 49 | */ 50 | public abstract void execute(HttpServletRequest req, 51 | HttpServletResponse resp) throws Exception; 52 | } 53 | 54 | // 对HttpServletRequest进行包装 55 | class MyRequest extends HttpServletRequestWrapper { 56 | public MyRequest(HttpServletRequest request) { 57 | super(request); 58 | } 59 | 60 | // 修改增强getparamter方法 61 | @Override 62 | public String getParameter(String name) { 63 | // 先获取参数的值 64 | String value = super.getParameter(name); 65 | // 是否是get方法 66 | if (super.getMethod().equalsIgnoreCase("GET")) { 67 | System.err.println("这是GET...."); 68 | try { 69 | value = new String(value.getBytes("ISO-8859-1"), 70 | getCharacterEncoding()); 71 | } catch (UnsupportedEncodingException e) { 72 | e.printStackTrace(); 73 | } 74 | } 75 | return value; 76 | } 77 | 78 | @Override 79 | public String[] getParameterValues(String name) { 80 | String[] values = super.getParameterValues(name); // 先从父类中获取所有的值 81 | // 判断是否是GET 82 | if (getMethod().equalsIgnoreCase("GET")) { 83 | for (int i = 0; i < values.length; i++) { 84 | try { 85 | values[i] = new String(values[i].getBytes("ISO-8859-1"), 86 | getCharacterEncoding()); 87 | } catch (UnsupportedEncodingException e) { 88 | e.printStackTrace(); 89 | } 90 | } 91 | } 92 | return values; 93 | } 94 | 95 | @Override 96 | public Map getParameterMap() { 97 | Map map = super.getParameterMap();// 从父类中获取参数 98 | // 是否是GET 99 | if (getMethod().equalsIgnoreCase("GET")) { 100 | Iterator> it = map.entrySet() 101 | .iterator(); 102 | try { 103 | while (it.hasNext()) { 104 | String[] values = it.next().getValue(); 105 | for (int i = 0; i < values.length; i++) { 106 | values[i] = new String( 107 | values[i].getBytes("ISO-8859-1"), 108 | getCharacterEncoding()); 109 | } 110 | } 111 | } catch (Exception e) { 112 | 113 | } 114 | } 115 | return map; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/cn/hncu/utils/IDUtils.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.utils; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | import java.util.UUID; 6 | /** 7 | * 生成UUID和生成时间使用 8 | * @author 陈浩翔 9 | * 2016-12-27 10 | */ 11 | public class IDUtils { 12 | /** 13 | * 生成UUID 14 | * @return 15 | */ 16 | public static String uuid(){ 17 | String uuid = UUID.randomUUID().toString().replaceAll("-",""); 18 | return uuid; 19 | } 20 | 21 | public static String timeToString(long time){ 22 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 23 | return sdf.format(new Date(time)); 24 | } 25 | 26 | public static void main(String[] args) { 27 | System.out.println(timeToString(new Date().getTime())); 28 | System.out.println(new Date().getTime()); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/cn/hncu/utils/PasswordUtils.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.utils; 2 | import java.util.UUID; 3 | 4 | import org.apache.log4j.Logger; 5 | import org.springframework.security.authentication.encoding.Md5PasswordEncoder; 6 | /** 7 | * 盐和密码 8 | * @author 陈浩翔 9 | * 10 | * 2016-12-27 11 | */ 12 | public class PasswordUtils { 13 | private static Logger log = Logger.getLogger(PasswordUtils.class); 14 | 15 | /** 16 | * 生成盐 17 | */ 18 | public static String getSolt(){ 19 | String solt = UUID.randomUUID().toString().replace("-", ""); 20 | log.info("盐为:"+solt); 21 | return solt; 22 | } 23 | 24 | /** 25 | * 参数1为原密码,参数2为盐值 26 | */ 27 | public static String md5(String password,String solt){ 28 | Md5PasswordEncoder en = new Md5PasswordEncoder(); 29 | String str = en.encodePassword(password.toLowerCase(), solt.toLowerCase()); 30 | log.info("加密以后值为:"+str); 31 | return str; 32 | } 33 | 34 | public static void main(String[] args) { 35 | //String pwd = PasswordUtils.md5("1234", "chx");//8591bfa530427dec20b1992c63322830 36 | //String pwd = PasswordUtils.md5("a", "a");//21b0304492b4e80831d66abd78514f29 37 | String pwd = PasswordUtils.md5("admin", "admin");//ceb4f32325eda6142bd65215f4c0f371 38 | System.out.println(pwd); 39 | 40 | System.out.println("盐为:"+getSolt()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/cn/hncu/utils/QueryRunner.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.utils; 2 | import java.beans.PropertyDescriptor; 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.sql.Statement; 8 | import javax.sql.DataSource; 9 | 10 | import org.apache.commons.dbutils.ResultSetHandler; 11 | /** 12 | * 13 | * @author 陈浩翔 14 | * 15 | * 2016-12-27 16 | */ 17 | public class QueryRunner extends org.apache.commons.dbutils.QueryRunner{ 18 | public QueryRunner(){ 19 | super(); 20 | } 21 | public QueryRunner(DataSource ds){ 22 | super(ds); 23 | } 24 | @Override 25 | public int[] batch(Connection arg0, String arg1, Object[][] arg2){ 26 | try { 27 | return super.batch(arg0, arg1, arg2); 28 | } catch (SQLException e) { 29 | throw new RuntimeException(e.getMessage(),e); 30 | } 31 | } 32 | @Override 33 | public int[] batch(String sql, Object[][] params){ 34 | try { 35 | return super.batch(sql, params); 36 | } catch (SQLException e) { 37 | throw new RuntimeException(e.getMessage(),e); 38 | } 39 | 40 | } 41 | 42 | @Override 43 | protected void close(Connection conn) { 44 | try { 45 | super.close(conn); 46 | } catch (SQLException e) { 47 | throw new RuntimeException(e.getMessage(),e); 48 | } 49 | 50 | } 51 | 52 | @Override 53 | protected void close(ResultSet rs){ 54 | try { 55 | super.close(rs); 56 | } catch (SQLException e) { 57 | throw new RuntimeException(e.getMessage(),e); 58 | } 59 | } 60 | 61 | @Override 62 | protected void close(Statement stmt){ 63 | try { 64 | super.close(stmt); 65 | } catch (SQLException e) { 66 | throw new RuntimeException(e.getMessage(),e); 67 | } 68 | } 69 | 70 | @Override 71 | public void fillStatement(PreparedStatement arg0, Object... arg1) 72 | { 73 | try { 74 | super.fillStatement(arg0, arg1); 75 | } catch (SQLException e) { 76 | throw new RuntimeException(e.getMessage(),e); 77 | } 78 | 79 | } 80 | 81 | @Override 82 | public void fillStatementWithBean(PreparedStatement arg0, Object arg1, 83 | PropertyDescriptor[] arg2){ 84 | try { 85 | super.fillStatementWithBean(arg0, arg1, arg2); 86 | } catch (SQLException e) { 87 | throw new RuntimeException(e.getMessage(),e); 88 | } 89 | 90 | } 91 | 92 | @Override 93 | public void fillStatementWithBean(PreparedStatement arg0, Object arg1, 94 | String... arg2) { 95 | try { 96 | super.fillStatementWithBean(arg0, arg1, arg2); 97 | } catch (SQLException e) { 98 | throw new RuntimeException(e.getMessage(),e); 99 | } 100 | 101 | } 102 | 103 | @Override 104 | public DataSource getDataSource() { 105 | return super.getDataSource(); 106 | } 107 | 108 | @Override 109 | protected Connection prepareConnection() { 110 | try { 111 | return super.prepareConnection(); 112 | } catch (SQLException e) { 113 | throw new RuntimeException(e.getMessage(),e); 114 | } 115 | 116 | } 117 | 118 | @Override 119 | protected PreparedStatement prepareStatement(Connection conn, String sql) 120 | { 121 | try { 122 | return super.prepareStatement(conn, sql); 123 | } catch (SQLException e) { 124 | throw new RuntimeException(e.getMessage(),e); 125 | } 126 | 127 | } 128 | 129 | @Override 130 | public T query(Connection conn, String sql, Object param, 131 | ResultSetHandler rsh) { 132 | try { 133 | return super.query(conn, sql, param, rsh); 134 | } catch (SQLException e) { 135 | throw new RuntimeException(e.getMessage(),e); 136 | } 137 | 138 | } 139 | 140 | @Override 141 | public T query(Connection conn, String sql, Object[] params, 142 | ResultSetHandler rsh) { 143 | try { 144 | return super.query(conn, sql, params, rsh); 145 | } catch (SQLException e) { 146 | throw new RuntimeException(e.getMessage(),e); 147 | } 148 | 149 | } 150 | 151 | public T query(Connection arg0, String arg1, ResultSetHandler arg2, 152 | Object... arg3){ 153 | try { 154 | return super.query(arg0, arg1, arg2, arg3); 155 | } catch (SQLException e) { 156 | throw new RuntimeException(e.getMessage(),e); 157 | } 158 | 159 | } 160 | 161 | @Override 162 | public T query(Connection conn, String sql, ResultSetHandler rsh) 163 | { 164 | try { 165 | return super.query(conn, sql, rsh); 166 | } catch (SQLException e) { 167 | throw new RuntimeException(e.getMessage(),e); 168 | } 169 | 170 | } 171 | 172 | @Override 173 | public T query(String sql, Object param, ResultSetHandler rsh) 174 | { 175 | try { 176 | return super.query(sql, param, rsh); 177 | } catch (SQLException e) { 178 | throw new RuntimeException(e.getMessage(),e); 179 | } 180 | 181 | } 182 | 183 | @Override 184 | public T query(String sql, Object[] params, ResultSetHandler rsh) 185 | { 186 | try { 187 | return super.query(sql, params, rsh); 188 | } catch (SQLException e) { 189 | throw new RuntimeException(e.getMessage(),e); 190 | } 191 | 192 | } 193 | 194 | @Override 195 | public T query(String sql, ResultSetHandler rsh, Object... params) 196 | { 197 | try { 198 | return super.query(sql, rsh, params); 199 | } catch (SQLException e) { 200 | throw new RuntimeException(e.getMessage(),e); 201 | } 202 | 203 | } 204 | 205 | @Override 206 | public T query(String sql, ResultSetHandler rsh){ 207 | try { 208 | return super.query(sql, rsh); 209 | } catch (SQLException e) { 210 | throw new RuntimeException(e.getMessage(),e); 211 | } 212 | 213 | } 214 | 215 | @Override 216 | protected void rethrow(SQLException cause, String sql, Object... params) 217 | { 218 | try { 219 | super.rethrow(cause, sql, params); 220 | } catch (SQLException e) { 221 | throw new RuntimeException(e.getMessage(),e); 222 | } 223 | 224 | } 225 | 226 | @Override 227 | public int update(Connection arg0, String arg1, Object... arg2) 228 | { 229 | try { 230 | return super.update(arg0, arg1, arg2); 231 | } catch (SQLException e) { 232 | throw new RuntimeException(e.getMessage(),e); 233 | } 234 | 235 | } 236 | 237 | @Override 238 | public int update(Connection conn, String sql, Object param) 239 | { 240 | try { 241 | return super.update(conn, sql, param); 242 | } catch (SQLException e) { 243 | throw new RuntimeException(e.getMessage(),e); 244 | } 245 | } 246 | 247 | @Override 248 | public int update(Connection conn, String sql) { 249 | try { 250 | return super.update(conn, sql); 251 | } catch (SQLException e) { 252 | throw new RuntimeException(e.getMessage(),e); 253 | } 254 | 255 | } 256 | 257 | @Override 258 | public int update(String sql, Object... params){ 259 | try { 260 | return super.update(sql, params); 261 | } catch (SQLException e) { 262 | throw new RuntimeException(e.getMessage(),e); 263 | } 264 | 265 | } 266 | 267 | @Override 268 | public int update(String sql, Object param){ 269 | try { 270 | return super.update(sql, param); 271 | } catch (SQLException e) { 272 | throw new RuntimeException(e.getMessage(),e); 273 | } 274 | 275 | } 276 | 277 | @Override 278 | public int update(String sql) { 279 | try { 280 | return super.update(sql); 281 | } catch (SQLException e) { 282 | throw new RuntimeException(e.getMessage(),e); 283 | } 284 | 285 | } 286 | 287 | @Override 288 | protected ResultSet wrap(ResultSet rs) { 289 | return super.wrap(rs); 290 | } 291 | } 292 | -------------------------------------------------------------------------------- /src/cn/hncu/utils/tx/Transaction.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.utils.tx; 2 | import java.lang.annotation.ElementType; 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | import java.lang.annotation.Target; 6 | @Retention(RetentionPolicy.RUNTIME) 7 | @Target(value=ElementType.METHOD) 8 | public @interface Transaction { 9 | } 10 | -------------------------------------------------------------------------------- /src/cn/hncu/utils/tx/TxProxy.java: -------------------------------------------------------------------------------- 1 | package cn.hncu.utils.tx; 2 | import java.lang.reflect.InvocationHandler; 3 | import java.lang.reflect.Method; 4 | import java.lang.reflect.Proxy; 5 | import java.sql.Connection; 6 | import org.apache.log4j.Logger; 7 | 8 | import cn.hncu.utils.DataSourceUtils; 9 | /** 10 | * 事务的代理 11 | * @author 陈浩翔 12 | * 2016-12-27 13 | */ 14 | public class TxProxy implements InvocationHandler { 15 | private Logger log = Logger.getLogger(TxProxy.class); 16 | private Object srcObject; 17 | private TxProxy(Object o) { 18 | this.srcObject = o; 19 | } 20 | @SuppressWarnings("unchecked") 21 | public static T getProxy(Object src) { 22 | Object proxedObj = Proxy.newProxyInstance( 23 | TxProxy.class.getClassLoader(), src.getClass().getInterfaces(), 24 | new TxProxy(src)); 25 | return (T)proxedObj; 26 | } 27 | @SuppressWarnings("unchecked") 28 | public static T getProxy(Object src,Class cls) { 29 | Object proxedObj = Proxy.newProxyInstance( 30 | TxProxy.class.getClassLoader(), src.getClass().getInterfaces(), 31 | new TxProxy(src)); 32 | return (T)proxedObj; 33 | } 34 | @SuppressWarnings("unchecked") 35 | public static T getProxy(Class cls) { 36 | Object src=null; 37 | try { 38 | src = cls.newInstance(); 39 | }catch(Exception e){ 40 | e.printStackTrace(); 41 | } 42 | Object proxedObj = Proxy.newProxyInstance( 43 | TxProxy.class.getClassLoader(), src.getClass().getInterfaces(), 44 | new TxProxy(src)); 45 | return (T)proxedObj; 46 | } 47 | 48 | public Object invoke(Object proxy, Method method, Object[] args) 49 | throws Throwable { 50 | if (method.isAnnotationPresent(Transaction.class)) { 51 | Connection conn = null; 52 | Object returnValue = null; 53 | try { 54 | conn = DataSourceUtils.getConnection(); 55 | log.info("开始事务。连接对象为:"+conn); 56 | conn.setAutoCommit(false); 57 | returnValue = method.invoke(srcObject, args); 58 | log.info("提交一个事务"); 59 | conn.commit(); 60 | } catch (Exception e) { 61 | log.info("事务出错回滚"); 62 | conn.rollback(); 63 | throw new RuntimeException(e.getMessage(), e); 64 | } finally { 65 | log.info("将Connection放回到池中"); 66 | conn.setAutoCommit(true); 67 | conn.close(); 68 | /** 69 | * 为了保证不出错,必须要remove一下 70 | */ 71 | DataSourceUtils.remove(); 72 | } 73 | return returnValue; 74 | } else { 75 | log.info("不存在此注解,不开事务。"); 76 | return method.invoke(srcObject, args); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, stdout, logfile 2 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 3 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.stdout.layout.ConversionPattern=%d %p [%c<%L>] - <%m>%n 5 | 6 | log4j.appender.logfile=org.apache.log4j.RollingFileAppender 7 | log4j.appender.logfile.File=d:/codeforum/codeforum.log 8 | log4j.appender.logfile.MaxFileSize=5120KB 9 | log4j.appender.logfile.MaxBackupIndex=3 10 | log4j.appender.logfile.layout=org.apache.log4j.PatternLayout 11 | log4j.appender.logfile.layout.ConversionPattern=%d %p [%c<%L>] - %m%n --------------------------------------------------------------------------------