struts2 making me go mad

2019-02-26 04:01发布

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.

But I am getting this error:

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

1条回答
Lonely孤独者°
2楼-- · 2019-02-26 04:21

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

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

The standard workflow

JSP -> Interceptor Stack -> 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.

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.

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>

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

查看更多
登录 后发表回答