java web的ssh框架_JavaWeb_(SSH论坛)_二、框架整合

基于SSH框架的小型论坛项目

一、项目入门  传送门

二、框架整合  传送门

三、用户模块  传送门

四、页面显示  传送门

五、帖子模块  传送门

六、点赞模块  传送门

七、辅助模块传送门

导入Jar包

导入完别忘了Add Path

查看Eclipse IDE中导入的Jar包

Gary_SSHForum->Build Path->Configure Build Path

99c3765cfd49b56af3f989a3f9f49ac9.png

添加xml配置文件

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

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

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

/p>

"-//Hibernate/Hibernate Configuration DTD 3.0//EN"

"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

hibernate.cfg.xml

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

/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

/*

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

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中添加数据库

ddd35ebccb5060bb14b0b37aff269956.png

org.hibernate.dialect.MySQL5InnoDBDialect

update

true

true

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

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配置事务

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

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

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

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

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

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  传送门

061e1f146060341d9eb23e3a942319dd.png

把tomcat启动时间适当延长:

c419d7b9b17f6c7475a870dddd9c3bab.png

打开tomcat设置页,修改启动时间:

30667693fe7c2f9b34d42e0b366c3ab1.png

经上一步如果还是启动超时的话,可以对项目进行clean,它的作用是将工程中的.class文件全部删除,同时重新编译工程:

64e4a7215c4d85ae9e84d9e0aef7ef27.png

然后再次重新部署tomcat,启动即可

一、项目入门  传送门

二、框架整合  传送门

三、用户模块  传送门

四、页面显示  传送门

五、帖子模块  传送门

六、点赞模块  传送门

七、辅助模块  传送门

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值