posts - 325,  comments - 25,  trackbacks - 0
          1.注意在加載完hiberna包之后,放入以下三個(gè)jar包:spring.jar commons-collection-3.2.jar,commons-pool-1.3.jar
          2.從數(shù)據(jù)庫映射完vo之后,注意一對(duì)多,多對(duì)多等的配置
                 一對(duì)多: 如:“一”這方ExamType.hbm.xml 添加
                  <set name="questions" inverse="true"> //“一”這方?jīng)]有控制權(quán)
                       <key column="typeid"></key>
                       <one-to-many class="com.lhb.onlineexam.vo.Question"/>
                    </set>
                          
                      “多”這方Question.hbm.xml 添加
                          <many-to-one name="examtype" column="typeid" not-null="true" lazy="false" insert="false"></many-to-one>
                      “多”這方有控制權(quán)

               多對(duì)多:
                  如course.hbm.xml 
                  <set name="student" table="student_course" cascade="save-update"
                   inverse="true">
                       <key column="cou_id"></key>
                       <many-to-many column="stu_id"
                        class="com.lhb.first.vo.Student">
                       </many-to-many>
                  </set>

                  student.hbm.xml
                  
                      <set name="course" cascade="save-update" inverse="false"  //因?yàn)槭菍W(xué)生選課,不是課先學(xué)生,所以有控制權(quán)
                         table="student-course">
                             <key column="stu_id"></key>
                             <many-to-many column="cou_id"
                              class="com.lhb.first.vo.Course">
                             </many-to-many>
                        </set>

              3.   web.xml中的配置
              加入:
           <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/applicationContext.xml</param-value>
           </context-param>
           <servlet>
            <servlet-name>SpringContextServlet</servlet-name>
            <servlet-class>
             org.springframework.web.context.ContextLoaderServlet
            </servlet-class>
            <load-on-startup>1</load-on-startup>
           </servlet>
           <filter>
            <filter-name>requestContextFilter</filter-name>
            <filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
           </filter>
           <filter-mapping>
            <filter-name>requestContextFilter</filter-name>
            <url-pattern>/*</url-pattern>
           </filter-mapping>
           <filter>
            <filter-name>encodingFilter</filter-name>
            <filter-class>
             org.springframework.web.filter.CharacterEncodingFilter
            </filter-class>
            <init-param>
             <param-name>encoding</param-name>
             <param-value>UTF-8</param-value>
            </init-param>
           </filter>
           <filter-mapping>
            <filter-name>encodingFilter</filter-name>
            <url-pattern>/*</url-pattern>
           </filter-mapping>   

          4.在完成模型組件和業(yè)務(wù)邏輯組件之后,配置applicationContext.xml(注入bean)
          5.加入struts支持,配置struts-config.xml
              <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
              <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
            </plug-in> 
              如果使用spring的DelegatingRequestProcessor(此時(shí)可以沒有type屬性),則在struts-config.xml中加入
              <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"></controller>
              如果使用spring的DelegatingActionProxy(此時(shí)type都是type="org.springframework.web.struts.DelegatingActionProxy")
              struts-config.xml中什么也不加
                  
          posted on 2008-05-15 15:56 長春語林科技 閱讀(151) 評(píng)論(0)  編輯  收藏 所屬分類: util
          <2008年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

           

          長春語林科技?xì)g迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊(cè)

          收藏夾

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 玛多县| 郓城县| 高要市| 华阴市| 南投县| 栾川县| 昌吉市| 黄骅市| 松潘县| 同德县| 新河县| 天等县| 霍城县| 林芝县| 涪陵区| 安丘市| 丹江口市| 泸州市| 横峰县| 卢龙县| 白水县| 安阳市| 澳门| 柳州市| 红河县| 全椒县| 武清区| 南岸区| 昔阳县| 阜阳市| 红河县| 乌兰浩特市| 扶风县| 海安县| 五华县| 富民县| 临汾市| 玉田县| 赤城县| 博客| 洛南县|