搭建ssh1步骤

发布时间:2016-12-6 22:15:01 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"搭建ssh1步骤",主要涉及到搭建ssh1步骤方面的内容,对于搭建ssh1步骤感兴趣的同学可以参考一下。

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">    <!--监听spring  -->  <listener>   <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>   </listener>   <!-- 加载spring配置文件 -->   <context-param>   <param-name>contextConfigLocation</param-name>   <param-value>classpath*:**/spring-*.xml</param-value>   </context-param>   <servlet>     <servlet-name>action</servlet-name>     <servlet-class>com.cvicse.cmstest.common.web.control.ActionServlet</servlet-class>     <init-param>       <param-name>config</param-name>       <param-value>classpath*:**/struts-*.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>   <welcome-file-list>     <welcome-file>index.jsp</welcome-file>   </welcome-file-list> </web-app> logfj4: log4j.rootLogger = debug,  stdout  log4j.appender.stdout = org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target = System.out log4j.appender.stdout.Threshold = warn  log4j.appender.stdout.layout = org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern =%d{yyyy-MM-dd HH:mm:ss,SSS} [%p] -%l -%m%n spring-common-dao: <?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="DaoSupport" abstract="true"> <property name="sessionFactory" ref="sessionFactory"/> </bean> </beans> spring-datasource: <?xml version="1.0" encoding="GBK"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"> </property> <property name="url" value="jdbc:mysql://localhost:3306/ssh?useUnicode=true&amp;characterEncoding=GBK"> </property> <property name="username" value="root"></property> <property name="password" value="sun"></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.MySQLDialect </prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <property name="mappingLocations"> <list> <value>classpath*:com/cvicse/cmstest/pojo/*.hbm.xml</value> </list> </property> </bean> <!-- 配置事务处理 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> <!--设置service层 事务处理的方法 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="save*" /> <tx:method name="add*" /> <tx:method name="query*" /> <tx:method name="delete*" /> <tx:method name="update*" /> <tx:method name="load*" /> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut id="DAOServicePointcut" expression="execution(* com.cvicse.cmstest.*.service.impl.*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="DAOServicePointcut" /> </aop:config> </beans> spring的配置文件的配法: ?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:aop="http://www.springframework.org/schema/aop" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <!--DAO层类--> <bean id="pcDAO" class="com.cvicse.cmstest.baseData.dao.Impl.PcDAOImpl" parent="DaoSupport"> </bean> <!--service层类--> <bean id="pcService" class="com.cvicse.cmstest.baseData.service.impl.PcServiceImpl"> <property name="pcDAO" ref="pcDAO"></property> </bean> <!--action层类--> <bean name="/pcinfo" class="com.cvicse.cmstest.baseData.action.TestAction"> <property name="pcService" ref="pcService"></property> </bean> </beans> struts1的配置文件: <?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="sh1Bean" type="org.apache.struts.action.DynaActionForm">   <form-property name="sh1Bean" type="com.cvicse.cmstest.baseData.dto.SH1Bean"></form-property>   </form-bean>   </form-beans>   <global-exceptions />   <global-forwards />   <action-mappings>   <action parameter="method" name="sh1Bean" path="/pcinfo" scope="request" type="com.cvicse.cmstest.baseData.action.TestAction"> <forward name="SUCCESS" path="/Test.jsp"/> <forward name="ADDSUCCESS" path="/addsuccess.jsp"/> </action>     </action-mappings>   <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"></controller>   <message-resources parameter="com.yourcompany.struts.ApplicationResources" /> </struts-config>

上一篇:Head First设计模式学习之一《策略模式》
下一篇:France '98

相关文章

关键词: 搭建ssh1步骤

相关评论