ssh项目重要配置文件综合

web-xml:



<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/classes/applicationContext.xml</param-value>
  </context-param>
  <listener>
   <listener-class>
     org.springframework.web.context.ContextLoaderListener
   </listener-class>
  </listener>
 
  <filter>
<filter-name>characterencodingfilter</filter-name>
<filter-class>com.xyb.filter.CharacterEncodingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>characterencodingfilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
  <servlet>
    <servlet-name>action</servlet-name>
     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>3</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>3</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
</web-app>





struts-config.xml:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config>
  <form-beans>
   <form-bean name="loginform" type="com.xyb.form.LoginForm"></form-bean>
    <form-bean name="loginf" type="com.xyb.form.SalesLoginForm"></form-bean>
  </form-beans>
  <action-mappings>
   <action path="/login"
      type="com.xyb.action.LoginAction"
      name="loginform"
      validate="true"
      input="/login.jsp"
      >
    <forward name="success" path="/success.jsp"></forward>
    <forward name="error" path="/error.jsp"></forward>   
   </action>
  
   <action path="/saleslogin"
      type="com.xyb.action.SalesLoginAction"
      name="loginf"
      validate="true"
      include="/SalesLogin.jsp">
    <forward name="success" path="/success.jsp"></forward>
    <forward name="error" path="/error.jsp"></forward>
   </action>
  
   <action path="/select"
           type="com.xyb.action.SelectAction">
     <forward name="success" path="/select.jsp"></forward>     
   </action>
  
   <action path="/delete"
           type="com.xyb.action.DeleteAction">
      <forward name="success" path="/select.jsp"></forward>      
    </action>
  </action-mappings>
  <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"></controller>
  <message-resources parameter="com.xyb.struts.ApplicationResources" />
</struts-config>





hibernate.cfg.xml:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- Generated by MyEclipse Hibernate Tools.                   -->
<hibernate-configuration>

    <session-factory>
      <property name="connection.driver_class">
        oracle.jdbc.driver.OracleDriver
      </property>
      <property name="connection.url">
        jdbc:oracle:thin:@localhost:1521:orcl
      </property>
      <property name="connection.username">scott</property>
      <property name="connection.password">tiger</property>
      <property name="dialect">
         org.hibernate.dialect.Oracle9Dialect
      </property>
      <property name="show_sql">true</property>
      <property name="format_sql">true</property>
      <mapping resource="com/xyb/po/User.hbm.xml"/>
    </session-factory>
</hibernate-configuration>



applicationContext.xml:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<bean name="/login" class="com.xyb.action.LoginAction">
<property name="service" ref="fservice"></property>
</bean>
<bean name="/select" class="com.xyb.action.SelectAction">
<property name="service" ref="fservice"></property>
</bean>
<bean name="/delete" class="com.xyb.action.DeleteAction">
<property name="service" ref="fservice"></property>
</bean>
<bean id="fservice" class="com.xyb.service.LoginServiceImpl">
<property name="dao" ref="userDao"></property>
</bean>
<bean id="userDao" class="com.xyb.dao.LoginDaoImpl">
<property name="hibernateTemplate" ref="template"></property>
</bean>
<bean id="template"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="factory"></property>
</bean>
<bean id="factory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocations"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="factory" />
</property>

</bean>
</beans>




User.hbm.xml:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>

<class name="com.xyb.po.User" table="t_user">
   <id name="id" column="t_id" type="integer">
     <generator class="native"></generator>
   </id>
   <property name="name" column="t_name" type="string"></property>
   <property name="password" column="t_password" type="string"></property>
   <property name="address" column="t_adress" type="string"></property>
   <property name="phone" column="t_phone" type="integer"></property>
</class>
</hibernate-mapping>











你可能感兴趣的:(oracle,Hibernate,xml,struts,ssh)