struts2让我发疯 [英] struts2 making me go mad

查看:130
本文介绍了struts2让我发疯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试制作一个Java项目.它使用Struts 2标签.每当单击按钮时,都有一个 Update 按钮,它应该更新数据库中的值.

I have been trying to make a java project. Its using Struts 2 tags. There is a button Update whenever it is to be clicked, it should update the values in the database.

但是我收到此错误:

未为操作com.comviva.im.ui.action.sysadmin.CUGAction和结果输入定义任何结果

No result defined for action com.comviva.im.ui.action.sysadmin.CUGAction and result input

推荐答案

未定义要采取的行动的结果 com.comviva.im.ui.action.sysadmin.CUG动作和结果输入

No result defined for action com.comviva.im.ui.action.sysadmin.CUGAction and result input

这意味着您在Struts.xml中缺少此Action的input结果的映射

This means that you are lacking the mapping for the input result for this Action in your Struts.xml

标准工作流程

JSP->拦截器堆栈->动作

JSP -> Interceptor Stack -> Action

在到达Action之前中断,很可能是由ConversionError拦截器(例如,将字符串发送到Integer),并且它返回时甚至没有到达Action.

is breaking BEFORE reaching the Action, most likely by the ConversionError Interceptor (eg. sending a String to an Integer, for example), and it is returning back without even reaching the Action.

进一步了解 Struts2 INPUT结果:它是如何工作的?如何处理转换/验证错误?

Read more on Struts2 INPUT result: how does it work? How are conversion / validation errors handled?

尝试返回时,找不到要去的地方.

When trying to come back, it can't find where to go.

所以您必须定义一个input结果类型:

So you must define an input result type:

<action name="CUGAction" class="com.comviva.im.ui.action.sysadmin.CUGAction">
    <result name="success">/your.jsp</result>
    <result name="input">/your.jsp</result>
</action>

然后使用<s:fielderror />

Then print out the error in your JSP with <s:fielderror /> and with <s:actionerrors />, and try to figure out what is happening.

这篇关于struts2让我发疯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆