加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

ssh实例

发布时间:2020-12-12 15:16:49 所属栏目:MsSql教程 来源:网络整理
导读:本人搞ssh(spring 1.3,hibernate 3.2,stuts1.3)搞了一天半才搞出来,发现有个包一定要删除掉。引进来真的会害死人。 这个包是asm-2.2.3.jar 现将主要配置文件附上, struts-config.xml ?xml version="1.0" encoding="UTF-8"? !DOCTYPE struts-config PUBLIC

本人搞ssh(spring 1.3,hibernate 3.2,stuts1.3)搞了一天半才搞出来,发现有个包一定要删除掉。引进来真的会害死人。

这个包是asm-2.2.3.jar

现将主要配置文件附上,

struts-config.xml

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

<struts-config>
? <form-beans>
? ?<form-bean name="userinfoform" type="com.dg.form.UserInfoActionForm"></form-bean>
? </form-beans>
? <global-exceptions />
? <global-forwards />
? <action-mappings>
? ?<action path="/Find" input="/index.jsp" scope="request"? name="userinfoform" type="com.dg.action.UserInfoAction" >
? ?????? ?<forward name="user" path="/index.jsp" />
? ?????? ?<forward name="sucess" path="/sucess.jsp"></forward>
? ?</action>
? </action-mappings>
??? <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor" />
? <message-resources parameter="com.yourcompany.struts.ApplicationResources" />
?? <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
??? <set-property property="contextConfigLocation" value="classpath:applicationContext.xml"/>
? </plug-in>
</struts-config>

?

?

ApplicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans
?xmlns="http://www.springframework.org/schema/beans"
?xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
?xmlns:p="http://www.springframework.org/schema/p"
?xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.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=MyOffice">
??</property>
??<property name="username" value="sa"></property>
??<property name="password" value="123"></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>
????<prop key="hibernate.show_sql">true</prop>
????<prop key="hibernate.format_sql">true</prop>
???</props>
??</property>
??<property name="mappingDirectoryLocations">
??<list>
???<value>classpath:com/dg/entities</value>
??</list>
??</property>
?</bean>
?<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
??<property name="sessionFactory">
???<ref local="sessionFactory" />
??</property>
?</bean>
?<bean id="userinfoDaoProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
??<property name="transactionManager">
???<ref bean="transactionManager" />
??</property>
??<property name="target">
???<ref local="userInfoDao" />
??</property>
??
??<property name="transactionAttributes">
???<props>
????<prop key="insert*">PROPAGATION_REQUIRED</prop>
????<prop key="update*">PROPAGATION_REQUIRED</prop>
????<prop key="*">PROPAGATION_REQUIRED</prop>
???</props>
??</property>
?</bean>
?<bean id="userInfoDao" class="com.dg.hibernateDao.UserInfoDao">
?<property name="sessionfactory"? ref="sessionFactory" />??
?</bean>
?<bean name="/Find" class="com.dg.action.UserInfoAction">
??<property name="userdao" ref="userinfoDaoProxy"></property>
?</bean>
?</beans>

哈哈,第一次搞ssh,写下来,以后参巧下。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读