基于SSH框架的小型论坛项目
一、项目入门 传送门
二、框架整合 传送门
三、用户模块 传送门
四、页面显示 传送门
五、帖子模块 传送门
六、点赞模块 传送门
七、辅助模块传送门
导入Jar包
导入完别忘了Add Path
查看Eclipse IDE中导入的Jar包
Gary_SSHForum->Build Path->Configure Build Path
添加xml配置文件
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
applicationContext.xml
/p>
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
hibernate.cfg.xml
/p>
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
struts.xml
整合Spring与Struts
org.springframework.web.context.ContextLoaderListener
contextConfigLocation
classpath:applicationContext.xml
openSession
org.springframework.orm.hibernate5.support.OpenSessionInViewFilter
openSession
/*
struts
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
struts
/*
Gary_SSHForum
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
org.springframework.web.context.ContextLoaderListener
contextConfigLocation
classpath:applicationContext.xml
openSession
org.springframework.orm.hibernate5.support.OpenSessionInViewFilter
openSession
/*
struts
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
struts
/*
web.xml
整合Spring与Hibernate
MySQL中添加数据库
org.hibernate.dialect.MySQL5InnoDBDialect
update
true
true
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
org.hibernate.dialect.MySQL5InnoDBDialect
update
true
true
applicationContext.xml
整合Spring与Hibernate配置事务
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
org.hibernate.dialect.MySQL5InnoDBDialect
update
true
true
applicationContext.xml
Gary_SSHForum
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
org.springframework.web.context.ContextLoaderListener
contextConfigLocation
classpath:applicationContext.xml
openSession
org.springframework.orm.hibernate5.support.OpenSessionInViewFilter
openSession
/*
struts
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
struts
/*
web.xml
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
org.hibernate.dialect.MySQL5InnoDBDialect
update
true
true
applicationContext.xml
项目过程中的问题
一、ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
Log4j2:用于输出日志
出现文件提前结束:xml的问题
struts添加了约束 必须要有
/p>
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
二、Tomcat启动超时问题Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds 传送门
把tomcat启动时间适当延长:
打开tomcat设置页,修改启动时间:
经上一步如果还是启动超时的话,可以对项目进行clean,它的作用是将工程中的.class文件全部删除,同时重新编译工程:
然后再次重新部署tomcat,启动即可
一、项目入门 传送门
二、框架整合 传送门
三、用户模块 传送门
四、页面显示 传送门
五、帖子模块 传送门
六、点赞模块 传送门
七、辅助模块 传送门