您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 公司方案 > ssh+extjs开发crud
2009-05-06Hibernate+Spring+Struts2+ExtJS开发CRUD功能关键字:extjs收藏Hibernate+Spring+Struts2+ExtJS开发CRUD功能1、入门:各种开源框架环境及下载:Hibernate:3.x需要hibernatecore和annotations包。Spring:2.x:2.x:2.X:JSON可以到查看详细内容,这里使用json-lib本所需要的包:2、配置:(1)首先是配置web.xml,配置方法可以在下面的配置文件代码注释中查看,这里主要是Struts2的配置:filterfilter-namestruts2/filter-namefilter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class/filterfilter-mappingfilter-namestruts2/filter-nameurl-pattern/*/url-pattern/filter-mapping和Spring的配置:context-paramparam-namecontextConfigLocation/param-nameparam-value/WEB-INF/spring/*.xml/param-value/context-paramlistenerlistener-classorg.springframework.web.context.ContextLoaderListener/listener-class/listenerWeb.xml的全部文件:?xmlversion=1.0encoding=UTF-8?web-appid=WebApp_IDversion=2.4xmlns=:xsi=:schemaLocation=://java.sun.com/xml/ns/j2ee/web-app_2_4.xsddisplay-namestruts2/display-name!--SpringApplicationContext配置文件的路径,可使用通配符*,多个路径用,号分隔,此参数用于后面的Spring-Contextloader--context-paramparam-namecontextConfigLocation/param-nameparam-value/WEB-INF/spring/*.xml/param-value/context-param!--著名CharacterEncodingfilter--filterfilter-nameencodingFilter/filter-namefilter-classorg.springframework.web.filter.CharacterEncodingFilter/filter-classinit-paramparam-nameencoding/param-nameparam-valueUTF-8/param-value/init-param/filter!--struts2滤镜配置--filterfilter-namestruts2/filter-namefilter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class/filterfilter-mappingfilter-namestruts2/filter-nameurl-pattern/*/url-pattern/filter-mapping!--SpringApplicationContext载入,必须--listenerlistener-classorg.springframework.web.context.ContextLoaderListener/listener-class/listener!--Spring刷新Introspector防止内存泄露--listenerlistener-classorg.springframework.web.util.IntrospectorCleanupListener/listener-class/listener!--session超时定义,单位为分钟--session-configsession-timeout10/session-timeout/session-configwelcome-file-listwelcome-fileindex.html/welcome-filewelcome-fileindex.htm/welcome-filewelcome-fileindex.jsp/welcome-filewelcome-filedefault.html/welcome-filewelcome-filedefault.htm/welcome-filewelcome-filedefault.jsp/welcome-file/welcome-file-list/web-app(2)Hibernate配置:?xmlversion=1.0encoding=UTF-8?!DOCTYPEhibernate-configurationPUBLIC-//Hibernate/HibernateConfigurationDTD3.0//EN!—-数据库驱动类名称--propertyname=hibernate.connection.driver_classoracle.jdbc.driver.OracleDriver/property!—-数据库用户名--propertyname=hibernate.connection.usernameMY/propertypropertyname=hibernate.default_schemaMY/property!—-数据库用户密码--propertyname=hibernate.connection.passwordMY/property!—-数据库连接字符串--propertyname=hibernate.connection.urljdbc:oracle:thin:@localhost:1521:loon/propertypropertyname=hibernate.dialectorg.hibernate.dialect.Oracle9Dialect/property!—-控制台是否输出SQL语句--propertyname=hibernate.show_sqltrue/propertymappingclass=privilege.database.Level//session-factory/hibernate-configuration(3)Spring基本配置:配置文件应该在WEB-INF/spring/下面?xmlversion=1.0encoding=UTF-8?!DOCTYPEbeansPUBLIC-//SPRING//DTDBEAN//EN=autodetect!—如果用的是XML配置文件,sessionFactory用这个配置org.springframework.orm.hibernate3.LocalSessionFactoryBean--beanid=sessionFactoryclass=org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBeanpropertyname=configLocationvalueclasspath:hibernate.cfg.xml/value/property!--配置多个hibernate.cfg.xmlpropertyname=configLocationslistvalueclasspath:hibernate_admin1.cfg.xml/valuevalueclasspath:hibernate_admin2.cfg.xml/value/list/property--/bean!--Hibernate事务管理--beanid=transactionManagerclass=org.springframework.orm.hibernate3.HibernateTransactionManagerpropertyname=sessionFactoryref=sessionFactory//beanbeanid=baseTransactionProxyclass=org.springframework.transaction.interceptor.TransactionProxyFactoryBeanabstract=truepropertyname=transactionManagerref=transactionManager/propertyname=transactionAttributespropspropkey=find*PROPAGATION_REQUIRED,readOnly/proppropkey=persist*PROPAGATION_REQUIRED,-Exception/proppropkey=remove*PROPAGATION_REQUIRED,-Exception/prop!--propkey=insert*PROPAGATION_REQUIRED/proppropkey=savePROPAGATION_REQUIRED/proppropkey=update*PROPAGATION_REQUIRED/proppropkey=edit*PROPAGATION_REQUIRED/proppropkey=del*PROPAGATION_REQUIRED/proppropkey=get*PROPAGATION_REQUIRED,readOnly/proppropkey=query*PROPAGATION_REQUIRED,readOnly/proppropkey=disPlay*PROPAGA
本文标题:ssh+extjs开发crud
链接地址:https://www.777doc.com/doc-6370775 .html