随笔-153  评论-235  文章-19  trackbacks-0
      今天,师弟开发时有遇到一个小问题:struts表单点取消时,出现org.apache.struts.action.InvalidCancelException异常,弄了一阵子,发现用了validate="true"就会出现此异常。然后找到 freiberg 的博客。

说到用

<set-property property="cancellable" value="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 1.2.9 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 1.2.9 and 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>

---------------------------------------end-----------------------------------------------------

刚好我用的是struts是1.2.9的

原文:http://www.blogjava.net/freiberg/archive/2007/10/20/154384.html

posted on 2007-10-31 16:25 流浪汗 阅读(1417) 评论(1)  编辑  收藏 所属分类: JAVA/J2EE

评论:
# re: org.apache.struts.action.InvalidCancelException 错误问题 2007-12-07 13:56 | freiberg
谢谢你的回复,大家共同提高,由于出差,回复的实在是晚啊,不好意思。。。  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: