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

问题描述:

今天新写了一个小功能,调试的时候提示找不到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的配置文件中没有给出处理结果
  1. public String execute() throws Exception{  
  2.     return "SUCCESS";  
  3. }  
  1. <action name="aaa"  class="adminLogQueryAction" method="execute">  
  2.     <result name="success" type="dispatcher">  
  3.         <param name="location">/aaa/aaa.jsp</param>  
  4.     </result>  
  5. </action>  
看来还是不够仔细
但是根据这个错误提示还真不好发现问题
 
解决方式:
  1. public String execute() throws Exception{  
  2.     return SUCCESS;  
  3. }  
 
备注:
  1. public interface Action {  
  2.   
  3.     /** 
  4.      * The action execution was successful. Show result 
  5.      * view to the end user. 
  6.      */  
  7.     public static final String SUCCESS = "success";  
  8.   
  9.     /** 
  10.      * The action execution was successful but do not 
  11.      * show a view. This is useful for actions that are 
  12.      * handling the view in another fashion like redirect. 
  13.      */  
  14.     public static final String NONE = "none";  
  15.   
  16.     /** 
  17.      * The action execution was a failure. 
  18.      * Show an error view, possibly asking the 
  19.      * user to retry entering data. 
  20.      */  
  21.     public static final String ERROR = "error";  
  22.   
  23.     /** 
  24.      * The action execution require more input 
  25.      * in order to succeed. 
  26.      * This result is typically used if a form 
  27.      * handling action has been executed so as 
  28.      * to provide defaults for a form. The 
  29.      * form associated with the handler should be 
  30.      * shown to the end user. 
  31.      * <p/> 
  32.      * This result is also used if the given input 
  33.      * params are invalid, meaning the user 
  34.      * should try providing input again. 
  35.      */  
  36.     public static final String INPUT = "input";  
  37.   
  38.     /** 
  39.      * The action could not execute, since the 
  40.      * user most was not logged in. The login view 
  41.      * should be shown. 
  42.      */  
  43.     public static final String LOGIN = "login";  
  44.   
  45.   
  46.     /** 
  47.      * Where the logic of the action is executed. 
  48.      * 
  49.      * @return a string representing the logical result of the execution. 
  50.      *         See constants in this interface for a list of standard result values. 
  51.      * @throws Exception thrown if a system level exception occurs. 
  52.      *                   <b>Note:</b> Application level exceptions should be handled by returning 
  53.      *                   an error value, such as <code>Action.ERROR</code>. 
  54.      */  
  55.     public String execute() throws Exception;  
  56.   

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值