<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆心得

    記我所見,記我所想

    BlogJava 首頁 新隨筆 聯系 聚合 管理
      34 Posts :: 0 Stories :: 16 Comments :: 0 Trackbacks

    Web.xml

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

    < web-app version = "2.4"

    ??? xmlns = "http://java.sun.com/xml/ns/j2ee"

    ??? xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"

    ??? xsi:schemaLocation = "http://java.sun.com/xml/ns/j2ee

    ??? >

    ?

    <! 自動加載一個以 GOpreation 開頭的xml文件 à

    ??? < servlet >

    ??? ?? < servlet-name > GOpreation </ servlet-name >

    ??? ?? < servlet-class > org.springframework.web.servlet.DispatcherServlet </ servlet-class >

    ??? ?? < load-on-startup > 1 </ load-on-startup >

    ??? </ servlet >

    ??? < servlet-mapping >

    ??????? < servlet-name > GOpreation </ servlet-name >

    ??????? < url-pattern > *.shtml </ url-pattern >

    ??? </ servlet-mapping >

    ??? < jsp-config >

    ?

    <! 注冊spring 標簽-->

    ?????? < taglib >

    ??????????? < taglib-uri > /spring </ taglib-uri >

    ??????????? < taglib-location > /WEB-INF/spring.tld </ taglib-location >

    ??????? </ taglib >

    ?? </ jsp-config >

    ?

    <! 設置 session 有效期- à

    ??? < session-config > ??

    ??????? < session-timeout > 60 </ session-timeout > ??

    ??? </ session-config >

    ?

    </ web-app >

    ?

    ?

    ? GOpreation -servlet.xml

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

    <! DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd" >

    ?

    < beans >

    ?

    <! class中的類去讀取value中的資源文件-->

    ??? < bean id = "propertyConfigurer" class = "org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >

    ??????? < property name = "location" value = "/WEB-INF/jdbc.properties" />

    ??? </ bean >

    ?

    <! 定義數據源,該beanID dataSource -->

    ??? < bean id = "dataSource" class = "org.springframework.jdbc.datasource.DriverManagerDataSource" >

    ??????? < property name = "driverClassName" value = "${jdbc.driverClassName}" />

    ??????? < property name = "url" value = "${jdbc.url}" />

    ??????? < property name = "username" value = "${jdbc.username}" />

    ??????? < property name = "password" value = "${jdbc.password}" />

    ?

    ??? </ bean >

    ?

    <!- 定義HibernateSessionFactory- à

    ??? < bean id = "sessionFactory" class = "org.springframework.orm.hibernate3.LocalSessionFactoryBean" >

    ?

    <! 依賴注入數據源,注冊的正式上文定義的dataSource-->

    ??????? < property name = "dataSource" ref = "dataSource" />

    ?

    <! mappingResource 屬性用來列出全部映射文件 >

    ??????? < property name = "mappingResources" >

    ??????????? < list >

    ?

    <! 以下用來列出所有的PO(Persistent Object持久化對象)映射文件-->

    ??????????????? < value > gos/hzyg/hdgos/model/Ahouse.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/RinRoomFix.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/MoldBuildList.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/Acompany.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/Soperator.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/RinRepair.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/RbuildFix.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/ClendType.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/Chut.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/AroomLevel.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/CstructType.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/Danalysis.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/RinStuctHouseSum.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/CstructForm.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/MsumTable.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/AroomFix.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/MbuildList.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/RroomFix.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/Cunit.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/CownerType.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/MroomList.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/AroomCheck.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/RinBuildFix.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/RinHouseSum.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/CdamageGrade.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/AbuildLevel.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/Dtproperties.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/AbuildSelfFix.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/AbuildCheck.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/ChouseUse.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/CbuildAge.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/RhouseSumStruct.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/RhouseSum.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/Rrepair.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/Zpara.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/Carea.hbm.xml </ value >

    ??????????????? < value > gos/hzyg/hdgos/model/AbuildSubCheck.hbm.xml </ value >

    ??????????? </ list >

    ??????? </ property >

    ?

    <!- 定義HibernateSessionFactory的屬性- à

    ?

    ??????? < property name = "hibernateProperties" >

    ??????????? < props >

    ?

    <! 指定 hibernate 的連接方言 >

    ??????????????? < prop key = "hibernate.dialect" > ${hibernate.dialect} </ prop >

    ?

    <! 指定是否打印sql語句 >

    ??????????????? < prop key = "hibernate.show_sql" > true </ prop >

    ?

    <! 待定以后補充 >

    ??????????????? < prop key = "hibernate.generate_statistics" > true </ prop >

    ??????????? </ props >

    ??????? </ property >


    ???? <
    property name = "eventListeners" >

    ?????? < map >

    ????????? < entry key = "merge" >

    ?????????? < bean class = "org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" />

    ???????? </ entry >

    ?????? </ map >

    ????? </ property >

    </ bean >

    ??? < bean id = "viewResolver" class = "org.springframework.web.servlet.view.InternalResourceViewResolver" >

    ??????? < property name = "prefix" >< value > /WEB-INF/view/ </ value ></ property >

    ??????? < property name = "suffix" >< value > .jsp </ value ></ property >

    ??? </ bean >

    ???

    <!-- urlMapping Space --> ??

    ??? < bean id = "urlMapping" class = "org.springframework.web.servlet.handler.SimpleUrlHandlerMapping" >

    ??????? < property name = "mappings" >

    ????????? < props >

    ??????????? <!-- 鄧毅TEST -->

    ????????????? < prop key = "/test.shtml" > testController </ prop >

    ??????????? <!-- 鄧毅TEST end -->

    ???????????

    ??????????? ? < prop key = "/seculist.shtml" > secuController </ prop >

    ??????????? ? < prop key = "/chutlist.shtml" > chutController </ prop >

    ??????????? ? < prop key = "/addhouse.shtml" > addhouController </ prop >

    ??????????? ? < prop key = "/inserhouse.shtml" > inserhouseController </ prop >

    ??????????? ? < prop key = "/buildlist.shtml" > BuildingListController </ prop >

    ??????????? ? <!-- 任喜海 start -->

    ??????????? ? < prop key = "/aroomlevellist.shtml" > AroomLeveListController </ prop >

    ??????????? ? <!-- 任喜海 end -->

    ??????????? ? ?

    ????????? </ props >

    ??????? </ property >

    ??? </ bean >

    <!-- urlMapping Space End-->

    ?

    <!-- *********************************************************? -->

    ?

    <!-- Dao Space -->

    ??? <!-- 鄧毅TEST -->

    ??? < bean id = "testDao" class = "gos.hzyg.hdgos.TEST.TestSql" >

    ??????? < property name = "sessionFactory" >

    ??????????? < ref local = "sessionFactory" />

    ??????? </ property >

    ??? </ bean >

    ??? <!--? 鄧毅TEST end -->

    ???

    ??? < bean id = "cuDao" class = "gos.hzyg.hdgos.dao.imp.secu.CunitDaoImp" >

    ??????? < property name = "sessionFactory" >

    ??????????? < ref local = "sessionFactory" />

    ??????? </ property >

    ??? </ bean >

    ???

    ??? < bean id = "ahDao" class = "gos.hzyg.hdgos.dao.imp.secu.AhouseDaoImp" >

    ??????? < property name = "sessionFactory" >

    ??????????? < ref local = "sessionFactory" />

    ??????? </ property >

    ??? </ bean >

    ??? < bean id = "chDao" class = "gos.hzyg.hdgos.dao.imp.secu.ChutDaoImp" >

    ??????? < property name = "sessionFactory" >

    ??????????? < ref local = "sessionFactory" />

    ??????? </ property >

    ??? </ bean >

    ??? < bean id = "csfDao" class = "gos.hzyg.hdgos.dao.imp.secu.CstructFormDaoImp" >

    ??????? < property name = "sessionFactory" >

    ??????????? < ref local = "sessionFactory" />

    ??????? </ property >

    ??? </ bean >

    ??? < bean id = "cstDao" class = "gos.hzyg.hdgos.dao.imp.secu.CstructTypeDaoImp" >

    ??????? < property name = "sessionFactory" >

    ??????????? < ref local = "sessionFactory" />

    ??????? </ property >

    ??? </ bean >

    ??? < bean id = "cwtDao" class = "gos.hzyg.hdgos.dao.imp.secu.CownerTypeDaoImp" >

    ??????? < property name = "sessionFactory" >

    ??????????? < ref local = "sessionFactory" />

    ??????? </ property >

    ??? </ bean >

    ??? < bean id = "cltDao" class = "gos.hzyg.hdgos.dao.imp.secu.ClendTypeDaoImp" >

    ??????? < property name = "sessionFactory" >

    ??????????? < ref local = "sessionFactory" />

    ??????? </ property >

    ??? </ bean >

    ??? < bean id = "cbaDao" class = "gos.hzyg.hdgos.dao.imp.secu.CbuildAgeDaoImp" >

    ??????? < property name = "sessionFactory" >

    ??????????? < ref local = "sessionFactory" />

    ??????? </ property >

    ??? </ bean >

    ??? < bean id = "AbuildDao" class = "gos.hzyg.hdgos.dao.imp.secu.AbuildDaoImp" >

    ??????? < property name = "sessionFactory" >

    ??????????? < ref local = "sessionFactory" />

    ??????? </ property >

    ??? </ bean >

    ??? <!-- add by renxh -->

    ??? < bean id = "arDao" class = "gos.hzyg.hdgos.dao.imp.secu.AroomLevelDaoImp" >

    ??????? < property name = "sessionFactory" >

    ??????????? < ref local = "sessionFactory" />

    ??????? </ property >

    ??? </ bean >

    ???

    ??? <!-- renxh end -->

    <!-- Dao Space End-->

    ?

    <!-- *********************************************************? -->

    ?

    <!-- Controller Space -->

    ??? <!--? 鄧毅TEST -->

    ??? < bean id = "testController" class = "gos.hzyg.hdgos.TEST.Test" >

    ??????? < property name = "listview" >

    ??????????? < value > test </ value >

    ??????? </ property >

    ??????? < property name = "testDao" >

    ??????????? < ref local = "testDao" />

    ??????? </ property >

    ??? </ bean >

    ?

    ??? <!--? 鄧毅TEST end -->

    ???

    ??? < bean id = "secuController" class = "gos.hzyg.hdgos.action.secu.SecuListController" >

    ??????? < property name = "listview" >

    ??????????? < value > secu/seculist </ value >

    ??????? </ property >

    ??????? < property name = "cuDao" >

    ??????????? < ref local = "cuDao" />

    ??????? </ property >

    ??????? < property name = "ahDao" >

    ??????????? < ref local = "ahDao" />

    ??????? </ property >

    ??? </ bean >

    ??? < bean id = "chutController" class = "gos.hzyg.hdgos.action.secu.ChutListController" >

    ??????? < property name = "listview" >

    ??? ??????? < value > secu/chutlist </ value >

    ??????? </ property >

    ??????? < property name = "chDao" >

    ??????????? < ref local = "chDao" />

    ??????? </ property >

    ??? </ bean >

    ??? < bean id = "addhouController" class = "gos.hzyg.hdgos.action.secu.AddhouseController" >

    ??? ?? < property name = "listview" >

    ??????????? < value > secu/addhouse </ value >

    ??????? </ property >

    ??????? < property name = "csfDao" >

    ??????????? < ref local = "csfDao" />

    ??????? </ property >

    ??????? < property name = "cstDao" >

    ??????????? < ref local = "cstDao" />

    ??????? </ property >

    ??????? < property name = "cwtDao" >

    ??????????? < ref local = "cwtDao" />

    ??????? </ property >

    ??????? < property name = "cltDao" >

    ??????????? < ref local = "cltDao" />

    ??????? </ property >

    ??????? < property name = "cbaDao" >

    ??????????? < ref local = "cbaDao" />

    ??????? </ property >

    ??? </ bean >

    ??? < bean id = "inserhouseController" class = "gos.hzyg.hdgos.action.secu.InserhouseController" >

    ??????? < property name = "listview" >

    ??????????? < value > secu/addhouse </ value >

    ??????? </ property >

    ??? ??? < property name = "ahDao" >

    ??????????? < ref local = "ahDao" />

    ??????? </ property >

    ??? </ bean >

    ??? < bean id = "BuildingListController" class = "gos.hzyg.hdgos.action.secu.buildlist.BuildingListController" >

    ??????? < property name = "listview" >

    ??????????? < value > secu/buildinglist </ value >

    ??????? </ property >

    ??????? < property name = "ahDao" >

    ??????????? < ref local = "AbuildDao" />

    ??????? </ property >

    ??? </ bean >

    ???

    ??? <!-- add by renxh -->

    ???

    ??? < bean id = "AroomLeveListController" class = "gos.hzyg.hdgos.action.secu.AroomLeveListController" >

    ??????? < property name = "listview" >

    ??????????? < value > secu/bungalowws </ value >

    ??????? </ property >

    ??????? < property name = "arDao" >

    ??????????? < ref local = "arDao" />

    ??????? </ property >

    ???

    ??? </ bean >

    ???

    ??? <!-- renxh end -->

    ?

    ?

    <!-- Controller Space End -->

    ?

    </ beans >


    Feedback

    # re: 初學 hibernate + spring 記錄 2007-04-29 16:37 源自有緣
    dao

    package gos.hzyg.hdgos.dao.secu;

    import java.util.List;

    /**
    * @author renxh
    * 針對平房完損等級評定做的接口
    */
    public interface AroomLevelDao {

    /**
    * 方法 getAllaRoomLevel()
    * 查詢所有的相關信息
    * @param cAreaid
    *
    */
    List getAllaRoomLevel();

    }

    接口實現

    /**
    * 作者:任喜海2007-4-27
    */
    package gos.hzyg.hdgos.dao.imp.secu;

    import java.util.List;

    import gos.hzyg.hdgos.dao.secu.AroomLevelDao;

    import org.hibernate.Query;
    import org.hibernate.Session;
    import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
    /**
    * @author renxh
    *
    */
    public class AroomLevelDaoImp extends HibernateDaoSupport implements
    AroomLevelDao {

    public List getAllaRoomLevel() {
    // TODO 自動生成方法存根
    Session session = this.getSession();
    Query query = null;
    String hql = "from AroomLevel where 1=1";

    query = session.createQuery(hql);
    List info = query.list();


    return info;
    }

    }

    對應的controller

    /**
    * 作者:任喜海2007-4-28
    */
    package gos.hzyg.hdgos.action.secu;

    import java.util.List;

    import gos.hzyg.hdgos.dao.secu.AroomLevelDao;
    import gos.hzyg.hdgos.dao.secu.ChutDao;

    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;

    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.mvc.Controller;

    /**
    * @author renxh
    *
    */
    public class AroomLeveListController implements Controller{

    private String listview;
    private AroomLevelDao arDao;



    public AroomLevelDao getArDao() {
    return arDao;
    }

    public void setArDao(AroomLevelDao arDao) {
    this.arDao = arDao;
    }

    public String getListview() {
    return listview;
    }

    public void setListview(String listview) {
    this.listview = listview;
    }

    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
    // TODO 自動生成方法存根
    System.out.println("@@@@@aRoomLevel@@@@@@@");

    List chinfo = arDao.getAllaRoomLevel();//取得所有平房信息


    HttpSession s=request.getSession();
    s.setAttribute("chinfo", chinfo);

    System.out.println("@@@@@III@@@@@@@");

    return new ModelAndView(this.getListview());
    }



    }
      回復  更多評論
      


    只有注冊用戶登錄后才能發(fā)表評論。


    網站導航:
     
    主站蜘蛛池模板: 永久免费看bbb| 亚洲精品二区国产综合野狼| 国产精品亚洲а∨无码播放不卡| 亚洲国产精品国产自在在线| 午夜老司机永久免费看片| 亚洲一区欧洲一区| 久久久久国产成人精品亚洲午夜| 无码A级毛片免费视频内谢| 亚洲欧美熟妇综合久久久久| 国产午夜亚洲精品理论片不卡 | 国产成人亚洲精品91专区高清 | 亚洲精品在线视频| 蜜桃成人无码区免费视频网站| 亚洲av永久无码一区二区三区 | 亚洲AV网一区二区三区| 亚洲AV永久青草无码精品| 成年人网站在线免费观看| 国产在线观看xxxx免费| 中国china体内裑精亚洲日本| 亚洲中久无码永久在线观看同| 亚洲成在人线aⅴ免费毛片| 一级特黄录像免费播放肥| 亚洲欧美日韩综合久久久久| 亚洲人成网址在线观看| 亚洲精品亚洲人成在线观看下载| 国产精品永久免费10000| 国产成年无码久久久免费| 国产在亚洲线视频观看| 亚洲高清中文字幕| 亚洲无码黄色网址| 国产黄色片在线免费观看| 黄色成人免费网站| 免费观看男人吊女人视频| 视频免费1区二区三区| 亚洲精品无码久久久久牙蜜区| 亚洲视频在线不卡| 国产精品亚洲不卡一区二区三区| 日本高清免费aaaaa大片视频| 91成人免费观看网站| 特级精品毛片免费观看| 香蕉免费看一区二区三区|