日期:2014-05-17  浏览次数:20760 次

S2SH配置问题!!!
就一个简单的注册功能 点击提交后报此错误,是配置问题,请各位大侠帮忙找下。。。

Unable to instantiate Action, userAction, defined for 'addUser' in namespace '/'userAction

java.lang.ClassNotFoundException: userAction

下面是各部分配置

JSP

  <s:form action="addUser" method="post">
  <s:textfield name="user.userName"></s:textfield>
  <s:password name="user.userPassword"></s:password>
  <s:submit></s:submit>
  </s:form>

Web.xml

  <welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<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>

  
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext*.xml</param-value>
</context-param>


struts.xml


  <package name="userInfo" namespace="" extends="struts-default">
<action name="addUser" class="userAction">
<result>/succes.jsp</result>
<result name="input">/index.jsp</result>
</action>
</package>


applicationContext.xml

   
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>

<bean id="CommonDao" class="Dao.UserInfoDao">
<property name="sessionFactory"
ref="sessionFactory">
</property>
</bean>

<bean id="UserInfoBiz" class="Biz.UserInfoBiz">
<property name="dao"
ref="CommonDao">
</property>
</bean>

<bean id="userAction" class="Action.addUser" scope="prototype">
<property name="biz"
ref="UserInfoBiz">
</property>
</bean>

Hibernate.cfg.xml

  <hibernate-configuration>

  <session-factory>
  <property name="connection.username">sa</property>
  <property name="connection.url">jdbc:sqlserver://localhost:1433;databaseName=User</property>
  <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
  <property name="myeclipse.connection.profile">User</property>
  <property name="connection.password">123</property>
  <property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</p