现在的位置: 首页 > 综合 > 正文

Invalid action class configuration that references an unknown class named [XX]

2013年11月11日 ⁄ 综合 ⁄ 共 2004字 ⁄ 字号 评论关闭

问题描述:

今天新写了一个小功能,调试的时候提示找不到action

1.adminLogQueryAction

2.Invalid action class configuration that references an unknown class named [adminLogQueryAction]

org/apache/catalina/loader/WebappClassLoader.java

stacktraces

java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [adminLogQueryAction]
 
问题分析:
提示里面描述的到是很清晰,找不到该action,初始以为没有在struts.xml文件中配置该action,仔细找了找发现该action已经配置上了
然后仔细找了找,发现action中方法的返回值在action的配置文件中没有给出处理结果
public String execute() throws Exception{
	return "SUCCESS";
}
<action name="aaa"  class="adminLogQueryAction" method="execute">
	<result name="success" type="dispatcher">
		<param name="location">/aaa/aaa.jsp</param>
	</result>
</action>
看来还是不够仔细
但是根据这个错误提示还真不好发现问题
 
解决方式:
public String execute() throws Exception{
	return SUCCESS;
}
 
备注:
public interface Action {

    /**
     * The action execution was successful. Show result
     * view to the end user.
     */
    public static final String SUCCESS = "success";

    /**
     * The action execution was successful but do not
     * show a view. This is useful for actions that are
     * handling the view in another fashion like redirect.
     */
    public static final String NONE = "none";

    /**
     * The action execution was a failure.
     * Show an error view, possibly asking the
     * user to retry entering data.
     */
    public static final String ERROR = "error";

    /**
     * The action execution require more input
     * in order to succeed.
     * This result is typically used if a form
     * handling action has been executed so as
     * to provide defaults for a form. The
     * form associated with the handler should be
     * shown to the end user.
     * <p/>
     * This result is also used if the given input
     * params are invalid, meaning the user
     * should try providing input again.
     */
    public static final String INPUT = "input";

    /**
     * The action could not execute, since the
     * user most was not logged in. The login view
     * should be shown.
     */
    public static final String LOGIN = "login";


    /**
     * Where the logic of the action is executed.
     *
     * @return a string representing the logical result of the execution.
     *         See constants in this interface for a list of standard result values.
     * @throws Exception thrown if a system level exception occurs.
     *                   <b>Note:</b> Application level exceptions should be handled by returning
     *                   an error value, such as <code>Action.ERROR</code>.
     */
    public String execute() throws Exception;

}

 

抱歉!评论已关闭.