当前位置: 代码迷 >> J2EE >> SSH 有关问题java.lang.RuntimeException: Invalid action class configuration
  详细解决方案

SSH 有关问题java.lang.RuntimeException: Invalid action class configuration

热度:178   发布时间:2016-04-22 01:11:06.0
【求助】SSH 问题java.lang.RuntimeException: Invalid action class configuration
SSH整合调用第一个aciton就悲剧。。
struts.xml
XML code
<struts> <package name="Zweibo" extends="struts-default">      <action name="base" class="base"></action>     <action name="login" class="loginAction" >         <result name="SUCCESS">success.jsp</result>             </action>         </package> <constant name="struts.objectFactory" value="spring"></constant></struts>    


applicationContext.xml相关代码
XML code
    <bean id="base" class="controller.BaseAction" scope="prototype">        <property name="allService">            <ref bean="allService" />        </property>    </bean>        <bean id="loginAction" class="controller.LoginAction" parent="base" scope="prototype">    </bean>    

login.jsp
HTML code
 <s:form action="login">         <s:textfield label="用户名" name="username"></s:textfield>         <s:password label="密码" name="password"></s:password>         <s:submit value="登录"></s:submit>        </s:form>


LoginAction.java
Java code
public class LoginAction extends BaseAction {    public String getUsername() {        return username;    }    public void setUsername(String username) {        this.username = username;    }    public String getPassword() {        return password;    }    public void setPassword(String password) {        this.password = password;    }    private String username;    private String password;        public String execute()throws Exception{        //if (this.getAllService().getLoginService().queryUsername(user)){//        if(username != null)    {//        return SUCCESS;//        }else//            return ERROR;        return SUCCESS;    }}

BaseAction里面是有个AllService属性,这里用不到,就不贴了。。
点击登陆按钮的时候出现下面的错误。
希望大牛帮帮忙啊。。。。泪。。。。


java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [loginAction]
org.apache.struts2.convention.ConventionsServiceImpl.determineResultPath(ConventionsServiceImpl.java:100)
org.apache.struts2.convention.ConventionUnknownHandler.determinePath(ConventionUnknownHandler.java:385)
org.apache.struts2.convention.ConventionUnknownHandler.handleUnknownResult(ConventionUnknownHandler.java:274)
com.opensymphony.xwork2.DefaultUnknownHandlerManager.handleUnknownResult(DefaultUnknownHandlerManager.java:76)
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:215)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:356)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
  相关解决方案