您的位置:首页 > 运维架构 > Apache

org.apache.struts.action.InvalidCancelException异常解决方法

2016-07-13 16:41 549 查看
页面报org.apache.struts.action.InvalidCancelException错误。上网查了一下,说是由于用了validate="true",而导致的异常。解决方案是在struts-config.xml文件中对应action下面添加一个属性cancellable="true"

---------------------------------引用--------------------------------------

Any existing applications that use the Cancel processing will need to modify their struts-config.xml to set the cancellable property for actions which require it.

In Struts the <set-property> is used to set the cancellable property for an action....

<action path="/fooAction"

input="/foo.jsp"

validate="true">

<set-property property="cancellable" value="true"/>

<forward name="success" path="/bar.jsp"/>

</action>From Struts 1.3.x a new cancellable attribute can be used....

<action path="/fooAction"

input="/foo.jsp"

validate="true"

cancellable="true">

<forward name="success" path="/bar.jsp"/>

</action>In both Struts nd Struts 1.3.x an exception handler can be configured to handle the InvalidCancelException

<action path="/fooAction"

input="/foo.jsp"

validate="true"

cancellable="true">

<forward name="success" path="/bar.jsp"/>

<exception key="errors.cancel"

type="org.apache.struts.action.InvalidCancelException"

path="/foo.jsp"/>

</action>

收藏于 2010-07-27
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  异常 struts