爱玩科技网
您的当前位置:首页SSH整合开发

SSH整合开发

来源:爱玩科技网
SSH融合

1:配置 Spring

复制Spring相关jar包、Spring配置文件:

aplicationcotext-beans.xml 和aplicationcotext-tx.xml(放AOP配置)

复制log4j.properties文件

2:<1>配置Struts

复制Struts相关jar包、jstl相关jar包、修改web.xml文件。 复制struts-config.xml文件和国际化相关资源包文件。

<2>Spring2.5以后要导入:spring-webmvc-struts.jar <3>在struts-config.xml 中配置Action时修改为Action的委托类 type=\"com.xunpoit.web.StudentForm\">

path=\"/log”和name=\"/login“ 相同 <4> aplicationcotext-beans.xml使Action纳入到Spring Ioc容器管理

<5>在Action类中注入业务类的方式来实现,Action代码:

public class UserAction extends Action { private UserBiz userBiz;

public void setUserBiz(UserBiz userBiz) { this.userBiz = userBiz; }…}

<6>web.xml文件配置字符编码过滤器

Spring character encoding filter

org.springframework.web.filter.CharacterEncodingFilter encoding utf-8

Spring character encoding filter /*

<7>web.xml文件配置全局参数(参考Spring实例项目):

contextConfigLocation

classpath*:applicationContext.xml

org.springframework.web.context.ContextLoaderListener

3:配置hibernate

复制hibernate相应的jar包,核心配置文件hibernate.cfg.xml MessageResources.properties信息配置文件

update

thread自动建表

<8>在aplicationcotext-tx.xml中配置AOP。

class=\"org.springframework.orm.hibernate3.LocalSessionFactoryBean\"> classpath:hibernate.cfg.xml

class=\"org.springframework.orm.hibernate3.HibernateTransactionManager\">

因篇幅问题不能全部显示,请点此查看更多更全内容