SSH框架搭建流程

SSH框架搭建

搭建环境:MyEclipse5.5 Sqlserver2005

第一步:在MyEclipse中创建一个WebProject工程,(ssh_project)

第二步:点击工程添加Struts支持,MyEclipse>>Add Struts Capabilities;(如图struts.png)

第三步:点击工程添加Spring支持,MyEclipst>>Add Spring Capabilities;(如图spring.png)

            勾选Spring2>>勾选Spring2.0ORM/DAO.........>>勾选Spring2.0 J2EE...>>勾选web Libraries

            JAR 勾选copy..... 完成

第四步:添加数据库连接 (DBBrowser  连接到Sqlserver2005数据库)(如图db.png)

第五步:点击工程添加Hibernate支持,MyEclipse>> Add Strust Capabilties;(如图hibernate1.2.3.4.png)

 

第六步:点击DB Browser 映射数据库表到Dao中(db2.png)

到这为止,基本搭建完毕然后要对搭建的框架修改

首先:删除多余,重复的jar 包(asm c3p0 cglb ) 添加 pool包

其次:

      

(1) Struts配置文件中配置插件,在struts-config.xml中加入:

       <<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

 

<struts-config>

           <data-sources />

           <form-beans >

                ……

             </form-beans>

   <global-exceptions />

           <global-forwards />

           <action-mappings >

               <action

attribute="userForm" name="userForm"  parameter="op"  path="/user" scope="request"

//关键地方

type="org.springframework.web.struts.DelegatingActionProxy">

                    <forward name="show" path="/show.jsp"></forward>

                    <forward name="error" path="/error.jsp"></forward>

                </action>

    </action-mappings>

  <message-resources parameter="com.y2t22_1_hr.struts.ApplicationResources" />

   //关键关键地方

 <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">

     <set-property property="contextConfigLocation"

                   value="classpath:applicationContext.xml"/>

  </plug-in>

</struts-config>

最后:

    Sping配置文件中applicationContext.xml <bean>要用name属性 name要与Sttutsaction中的path属性一致+

       <bean name=” /user” …..>

 

 

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值