搭建一个SSH项目框架的步骤

1、导入jar包(38个)

2、配置文件

applicationContext,xml (beans.xml) 

(数据源、LocalSessionFactoryBean、事务管理器、事务通知、AOP切面、组件扫描、对注解提供支持)

Struts.xml

3,web.xml

Struts2过滤器

<filter>

   <filter-name>action</filter-name>

   <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

</filter-class>

</filter>

Spring 的监听器contextConfigLocation

<context-param>

   <param-name>contextConfigLocation</param-name>

   <param-value>classpathbeans.xml</param-value>

</context-param>

<!--配置spring框架的上下文载入监听器-->

<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener

</listener-class>

</listener>

 

数据源配置:

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">

<property name="driverClass" value="${driverClass}"></property>

<property name="jdbcUrl" value="${jdbcUrl}"></property>

<property name="user" value="${user}"></property>

<property name="password" value="${password}"></property>

<property name="initialPoolSize" value="${initialPoolSize}"></property>

<property name="maxPoolSize" value="${maxPoolSize}"></property>

<property name="minPoolSize" value="${minPoolSize}"></property>

</bean>

Jdbc.properties  

    MySQL

driverClass=com.mysql.jdbc.Driver

jdbcUrl=jdbc:mysql://localhost:3306/数据库名

user=root

password=root

initialPoolSize=30

maxPoolSize=50

minPoolSize=30

     SqlServer

jdbc.driverClassName=net.sourceforge.jtds.jdbc.Driver

jdbc.url=jdbc:jtds:sqlserver://localhost:1433/数据名

jdbc.username=sa

jdbc.password=abc123

initialPoolSize=30

maxPoolSize=50

minPoolSize=30

Oracle

jdbc.driverClassName=oracle.jdbc.driver.OracleDriver

jdbc.url=jdbc:orcale:thin://localhost:1521/数据库名

jdbc.username=wapcms

jdbc.password=wapcms

 

你可能感兴趣的:(ssh)