Java Web项目开发培训.ppt
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
applicationContext.xml (2)
• <bean id="daoTemplate" abstract="true" lazy-init="true"> • <property name="sessionFactory" ref="sessionFactory" /> • </bean>
Java Web项目开发培训
Ssh2 + Jbpm4 + Oracle 10g 2010.5
程序开发规范 SSH2 框架整合 JBPM4基本概念 OA项目架构
程序开发规范
• 参见附件《编码开发规范》及《开发管理 工作流程》
SSH2 框架整合(配置文件)
• Eclipse (galileo) struts2 hibernate3 spring2 • Dynamic web project • Web.xml • Struts.xml • Hibernate.cfg.xml • applicationContext.xml
applicationContext.xml (1)
• <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
• <property name="configLocation" value="classpath:jbpm.hibernate.cfg.xml" />
• <property name="dataSource" ref="dataSource" /> • </bean> • <bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"> • <property name="driverClassName"
• <result name="nologin" type="redirect">/index1.jsp</result>
• </action>
Hibernate.cfg.xml
• <session-factory> • <property name="dialect"> • org.hibernate.dialect.OracleDialect • </property> • <property name="connection.driver_class"> • oracle.jdbc.driver.OracleDriver • </property> • <property name="connection.username">oa</property> • <property name="connection.password">aa2010</property> • <property name="connection.url"> • jdbc:oracle:thin:@172.168.0.1:1521:orcl • </property> • <property name="hibernate.c3p0.max_size">20</property> • <property name="hibernate.c3p0.min_size">1</property> • <property name="hibernate.c3p0.timeout">0</property> • <property name="hibernate.c3p0.max_statements">50</property> • <!-- <property name="hbm2ddl.auto">none</property>--> • <property name="show_sql">true</property> • <mapping resource="work/model/WorkComments.hbm.xml" />
•
<result name="work">/view/actionWork.jsp</result>
•
<result name="finish">/finish.jsp</result>
•
<result name="restrict">/error.jsp</result>
•ຫໍສະໝຸດ Baidu
<result name="tasklist">/view/viewTasklist.jsp</result>
• 2,创建Spring容器
• <listener>
• <listener-class>
• org.springframework.web.context.ContextLoaderListener
• </listener-class>
• </listener>
Structs.xml
• <action name="actionWork" class="workAction">
•
<result>/view/viewWork.jsp</result>
•
<result name="draft">/view/viewWorkDraft.jsp</result>
•
<result name="end">/view/viewWorkEnd.jsp</result>
•
<result name="new">/comment/newWork.jsp</result>
value="oracle.jdbc.driver.OracleDriver" /> • <property name="url" value="jdbc:oracle:thin:@172.168.0.1:1521:orcl"
/> • <property name="username" value="oa" /> • <property name="password" value="oa2010" /> • </bean>
Web.xml
• 1,定义filter拦截用户请求
• <filter>
•
<filter-name>struts2</filter-name>
•
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-
class>
• </filter>