整合SSH框架,出现
Servlet action is not availableweb.xml的配置文件如下: <servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<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-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
struts-config.xml的配置文件:<struts-config>
<data-sources />
<form-beans >
<form-bean name="userForm" type="struts.form.UserForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="userForm"
input="/JSP/user.jsp"
name="userForm"
path="/user"
scope="request"
type="struts.action.UserAction">
<forward name="success" path="/JSP/Success.jsp" />
<forward name="failure" path="/JSP/user.jsp" />
</action>
</action-mappings>
<plug-in
className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
</plug-in>
<controller
processorClass="org.springframework.web.struts.DelegatingRequestProcessor" />
<message-resources parameter="struts.ApplicationResources" />
</struts-config>
Spring中applicationContext.xml的配置如下:<beans>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>file:WebRoot/WEB-INF/hibernate.cfg.xml</value>
</property>
</bean>
<bean id="UseraDAO" class="HibernateSession.UseraDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean name="/user" class="struts.action.UserAction">
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="userDAOProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref local="transactionManager" />
</property>
<property name="target">
<ref local="UseraDAO" />