sshの構成


struts1.2+spring2.0+hibernate3.1
web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app id="WebApp">
	<display-name>dream</display-name> 
  <servlet>
      <servlet-name>action</servlet-name>
      <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
      <init-param>
         <param-name>application</param-name>
         <param-value>ApplicationResources</param-value>
      </init-param>
      <init-param>
         <param-name>config</param-name>
         <param-value>/WEB-INF/struts-config.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> 
	<servlet-name>SpringContextServlet</servlet-name> 
		<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class> 
		<load-on-startup>1</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>

2行目の説明は必ず書きます
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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver">
		</property>
		<property name="url" value="jdbc:oracle:thin:@localhost:1521:dream">
		</property>
		<property name="username" value="scott"></property>
		<property name="password" value="tiger"></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.Oracle9Dialect
				</prop>
			</props>
		</property>
		<property name="mappingResources">
			<list>
				<value>com/dream/vo/Users.hbm.xml</value></list>
		</property></bean>
		<bean id="userServiceImpl" class="com.dream.serviceimpl.UserServiceImpl">
			<property name="usersDAO">
				<ref bean="usersDAO" />
			</property>
		</bean>
	<bean id="usersDAO" class="com.dream.dao.UsersDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	
	<bean name="/login" class="com.dream.struts.action.LoginAction"
		abstract="false" lazy-init="default" autowire="default"
		dependency-check="default">
		<property name="userService">
			<ref bean="userServiceImpl" />
		</property>
	</bean>
	</beans>

struts-config.xml

<?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.dream.struts.form.LoginForm" />
  </form-beans>

  <global-exceptions />
  <global-forwards />
  <action-mappings >
    <action
      attribute="loginForm"
      input="/login.jsp"
      name="loginForm"
      parameter="method"
      path="/login"
      scope="request" type="org.springframework.web.struts.DelegatingActionProxy"/>

  </action-mappings>
  <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor" />
  <message-resources parameter="com.dream.struts.ApplicationResources" />
  <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
		<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
  </plug-in>
</struts-config>