ssh2配置文件
1:web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
2: struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.custom.i18n.resources" value="message" ></constant>
<constant name="struts.i18n.encoding" value="GBK" ></constant>
<constant name="struts.multipart.saveDir" value="C:\" ></constant>
<constant name="struts.multipart.maxSize" value="1000000000" ></constant>
<package name="struts2" extends="jfreechart-default">
<action name="login" class="LoginAction" >
<result name="success">/upload.jsp</result>
<result name="error">/error.jsp</result>
</action>
<action name="upload" class="org.struts2.action.UpLoadAction">
<result name="success">/index.jsp</result>
<result name="input">/upload.jsp</result>
</action>
<action name="download" class="org.struts2.action.DownLoadAction">
<result name="success" type="stream">
<param name="contentType"></param>
<param name="contentDisposition">filename="download"</param>
<param name="inputName">downloadFile</param>
</result>
</action>
<action name="showpic" class="org.struts2.action.JFreeChartAction">
<result name="success" type="chart">
<param name="width">1000</param>
<param name="height">800</param>
</result>
</action>
</package>
</struts>
3:appliationContext.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="LoginAction" class="org.struts2.action.LoginAction" >
</bean>
<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=filmsystem"></property>
<property name="username" value="sa"></property>
<property name="password" value="sundahua"></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>org/struts2/db/Liuyan.hbm.xml</value>
<value>org/struts2/db/Film.hbm.xml</value></list>
</property></bean>
<bean id="LiuyanDAO" class="org.struts2.db.LiuyanDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="FilmDAO" class="org.struts2.db.FilmDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean></beans>
浙公网安备 33010602011771号