在最近的strut2练习中遇到了一个非常隐蔽的问题,这个问题几乎花了我一天的时间。问题&解决方法如下:(project中的一部分代码)
创建了一个用于跳转的PoiterAction,代码再简单不过了,只有一个返回SUCCESS字符串的execute方法。
在struts.xml配置文件中配置了和SUCCESS对应的实体页面
<result name="success">xxxxx.jsp</result>
然后运行应用的时候调用该action时出现了 No result defined for action.....and result input 的错误。这个错误是没有在配置文件中给action添加所需要的
<result name="input">xxxxx.jsp</result>元素。
这就觉得奇怪了!我并没有任何数据需要提交到该action中啊。
最后做了很多的测试。原因是工程里有一个BaseAction的类,并且BaseAction使用了验证框架,有一个BaseAction-validation.xml的文件。
而PoiterAction正好是BaseAction的一个子类,也继承了父类的验证框架,因此按照验证框架的运行流程来看这个问题就很明显了。由于验证框架在调用子类的时候首先加载父类的验证规则,然后等待输入,系统会找到input元素制定的JSP文件的输入信息,但是PoiterAction并没有input项,所以系统抛出No result defined for action.....and result input。
删除了BaseAction-validation.xml文件后就可以正常运行了。
结论:在开发的时候应该尽量不对基类做任何验证,虽然使用继承基类的验证框架可以减少工作量,但是有时会出现不必要的麻烦。应该对具体类实施验证。
<!--EndFragment-->
分享到:
相关推荐
在IT领域,尤其是在Web开发中,遇到“No result defined for action”这类错误是常见的问题,尤其当使用Struts2框架时更为突出。此类错误通常指向在控制器(Action)中未正确配置或实现结果集(Result),导致请求...
### Struts2框架中“No result defined for action and result input”错误解析及解决方法 #### 错误概述 在Struts2框架中开发Web应用程序时,可能会遇到一个名为“No result defined for action and result input...
Your program’s input and output . . . . . . . . . . . . . . . . . . . . . . . . Debugging an already-running process . . . . . . . . . . . . . . . . . . . Killing the child process . . . . . . . . . ...
4.6 Your Program’s Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7 Debugging an Already-running Process . . . . . . . . . . . . . . . . . . . . . . 4.8 Killing the Child ...
Your program’s input and output . . . . . . . . . . . . . . . . . . . . . . . . Debugging an already-running process . . . . . . . . . . . . . . . . . . . Killing the child process . . . . . . . . . ...
4.6 Your Program’s Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7 Debugging an Already-running Process . . . . . . . . . . . . . . . . . . . . . . . . 4.8 Killing the ...
Software Testing and Continuous Quality Improvement <br>SECTION I SOFTWARE QUALITY IN PERSPECTIVE . . . . . . . . . . . . . . . 1 1 Quality Assurance Framework. . . . . . . . . . . . . . . . . ....
There is no defined model for how people write code in FreeBSD. However, Niels Jørgenssen has suggested a model of how written code is integrated into the project. Figure 4-1. Jørgenssen's model ...
创建默认的控制器(Action Controller) 7.1.2.6. 创建你的视图脚本 7.1.2.7. 创建你自己的错误控制器 7.1.2.8. 访问站点! 7.2. Zend_Controller 基础 7.3. 前端控制器 7.3.1. 概述 7.3.2. 主要方法 7.3....
No result defined for action cn.itcast.user.web.action.UserAction and result error ``` 此异常表明在`struts.xml`中没有为指定的动作定义结果。例如,如果期望动作在发生错误时转向特定的JSP页面,但配置文件...
of the INI constants (On, Off, True, False, Yes, No and None) or an expression ; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a ; previously set variable or directive (e.g. ${...
- Minor changes to the No operation error watchdog timer for the CD and Hard disk tests. - Minor correction to the Butterfly seek test. - Video playback trace logging increased. Release 5.3 build ...
错误信息:“No result defined for action com.upload.UploadAction and result input”。 这个错误通常是由于配置文件中没有正确定义动作的结果导致的。确保在`struts.xml`中为每个动作定义了合适的`result`标签...
在提供的内容中提到了一个错误 `No result defined for action com.sxit.smxt.action.XXXAction and result input`。这意味着Struts2框架无法找到对应Action的`input`结果定义。 #### 解决方案: - **检查配置文件*...
framework adds support for typing arbitrary blocks of data and handling it accordingly. This doesn't sound like much, but it is your basic MIME-type support found in many browsers and mail tools ...
The Project Manager is responsible for the project objectives to deliver the final product that has been defined, within the constraints of project scope, time, cost and required quality. Strengths...
Stops the action invocation immediately (by throwing a PauseException) and causes the action invocation to return the specified result, such as Action.SUCCESS, Action.INPUT, etc. void ...
For example, if T1 writes some object that is in T2’s input or output set, there is a dependency between T1 and T2. Bad Dependencies These include lost updates, dirty reads, non-repeatable reads, ...
集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...
The VariSpec always processes each command to completion before starting on the next command, and it has a 256 byte input buffer, so there is no problem issuing several commands at once; they will all...