已经纠结两个小时了  还在纠结  有没有人给我留个qq 加好友 详细说说  感谢各位了 我qq499422444

解决方案 »

  1.   

    小弟初学 有点不明白  <?xml version="1.0" encoding="UTF-8"?>
    <beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    <bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName"
    value="com.microsoft.sqlserver.jdbc.SQLServerDriver">
    </property>
    <property name="url"
    value="jdbc:sqlserver://127.0.0.1:1433;databaseName=test">
    </property>
    <property name="username" value="sa"></property>
    <property name="password" value="123456"></property>
    </bean>
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.SQLServerDialect
    </prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>com/entity/User1.hbm.xml</value></list>
    </property></bean> <bean id="userDao" class="com.impl.userDaoimpl">
    <property name="sessionFactory">
    <ref bean="sessionFactory"></ref>
    </property>
    </bean>
    <bean name="/login" class="com.yourcompany.struts.action.LoginAction">
    <property name="userDao" ref="userDao"></property></bean>
    </beans>
      

  2.   

    struts<?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>
      <data-sources />
      <form-beans >
        <form-bean name="loginForm" type="com.yourcompany.struts.form.LoginForm" />  </form-beans>  <global-exceptions />
      <global-forwards >
        <forward name="loginForm" path="/index.jsp" />  </global-forwards>  <action-mappings >
        <action
          attribute="loginForm"
          input="/login.jsp"
          name="loginForm"
          path="/login"
          scope="request"
          type="org.springframework.web.struts.DelegatingRequestProcessor" />  </action-mappings>  <message-resources parameter="com.yourcompany.struts.ApplicationResources" />
         <plug-in
    className="org.springframework.web.struts.ContextLoaderPlugIn">
    <set-property property="contextConfigLocation"
    value="/WEB-INF/applicationContext.xml" />
    </plug-in>
    </struts-config>