Hibernate和struts2的整合代码截图

来源:互联网 发布:虚拟机装mac os 编辑:程序博客网 时间:2024/05/16 16:02


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

                                         "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

 <session-factory>

  <property name="show_sql">true</property>

  <property name="format_sql">true</property>

  

  

  <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>

  <property name="hibernate.connection.password">admin</property>

  <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/wuliu?unicode=true&characterEncoding=utf-8</property>

  <property name="hibernate.connection.username">root</property>

  

  <!-- 为线程绑定一个session -->

  <property name="current_session_context_class">thread</property>

  

  <mapping resource="com/itqf/domain/DeliveryOrder.hbm.xml"/>

  <mapping resource="com/itqf/domain/Dictionary.hbm.xml"/>

  <mapping resource="com/itqf/domain/Order.hbm.xml"/>

  <mapping resource="com/itqf/domain/Orderrecord.hbm.xml"/>

  <mapping resource="com/itqf/domain/Relation.hbm.xml"/>

  <mapping resource="com/itqf/domain/Role.hbm.xml"/>

  <mapping resource="com/itqf/domain/Route.hbm.xml"/>

  <mapping resource="com/itqf/domain/Station.hbm.xml"/>

  <mapping resource="com/itqf/domain/TransportMoneyRule.hbm.xml"/>

  <mapping resource="com/itqf/domain/User.hbm.xml"/>

  <mapping resource="com/itqf/domain/RouteStation.hbm.xml"/>

  

  

 </session-factory>

</hibernate-configuration>

 

 

 

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

<!DOCTYPE struts PUBLIC

"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"

"http://struts.apache.org/dtds/struts-2.3.dtd">

 

<struts>

  

    <constant name="struts.devMode" value="true" />

    

  

<package name="default" namespace="/" extends="struts-default">

<default-action-ref name="toLogin"></default-action-ref>

<global-results>

<result name="input">/application/login.html</result>

<result name="error">/application/404.html</result>

</global-results>

<!--跳转到登录的action -->

<action name="toLogin">

<result>/application/login.html</result>

</action>

<!--处理登录 -->

<action name="login" class="com.itqf.web.action.UserAction" method="login">

<result>/application/index.jsp</result>

</action>

<!-- dingDanLieBiao  订单列表查询-->

<action name="dingDanLieBiao" class="com.itqf.web.action.OrderAction" method="findAll">

<result>/application/dingDanLieBiao.jsp</result>

</action>

<action name="dingDanLuRu" class="com.itqf.web.action.OrderAction"  method="findStation">

<result>/application/dingDanLuRu.jsp</result>

</action>

<!--新增订单 -->

<action name="addOrder" class="com.itqf.web.action.OrderAction" method="addOrder">

<!--成功后  跳转到新增成功的订单列表页面 -->

<result type="redirectAction">dingDanLieBiao</result>

</action>

</package>

 

</struts>

 

阅读全文
0 0