Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/389.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用RichFaces a4j:commandButton不使用submit_Java_Jsf_Richfaces - Fatal编程技术网

Java 如何使用RichFaces a4j:commandButton不使用submit

Java 如何使用RichFaces a4j:commandButton不使用submit,java,jsf,richfaces,Java,Jsf,Richfaces,我有一个类似这样的a4j:commandButton <a4j:commandButton id="stopBtn" type="button" reRender="lastOp" action="#{MyBacking.stop}" value="Stop" /> </a4j:commandButton> 其他不使用这种按钮的方法正在更新lastOp字段,但是我在控制台上没有看到任何关于这个按钮的内容。我把它当作按钮投对了吗?我应该把它放在h:form标

我有一个类似这样的
a4j:commandButton

    <a4j:commandButton id="stopBtn" type="button" reRender="lastOp"
  action="#{MyBacking.stop}" value="Stop" />
 </a4j:commandButton>
其他不使用这种按钮的方法正在更新lastOp字段,但是我在控制台上没有看到任何关于这个按钮的内容。我把它当作按钮投对了吗?我应该把它放在
h:form
标签中吗

firebug控制台显示:

this._form is null
我不明白


非常感谢您的帮助。

UICommand
组件应该放在
UIForm
组件中。那么,你猜呢

我应该把它放在
h:form
标签中吗

这是完全正确的:)这是因为他们触发了一个
POST
请求,唯一(正常)的方法是使用一个HTML
元素,该元素的
方法
属性设置为
“POST”
。Firebug还表示需要父表单元素,但它被解析为
null
,因此无法执行任何操作


只有像
h:outputLink
和consorts这样的“普通”链接不需要表单,因为它们只是发出一个
GET
请求。

是的,将其包装在表单中。我肯定BalusC会在我输入答案的时候发布详细的解释。(是的,在那里)

我要问你为什么不先尝试一个表单,然后再发布到这里。

看看你的代码:

<a4j:commandButton id="stopBtn" type="button" reRender="lastOp" action="#{MyBacking.stop}" value="Stop" /> 


您完成了
,为什么需要那个孤立的

如果出于某种原因您不想将按钮放在表单中,您可以执行以下操作:

<a4j:commandButton onclick="fireAjax()"/>

<h:form>
   <a4j:jsFunction name="fireAjax" action=".."/>
</h:form>

老实说,我当时想了两件事,如果我不在家的话,我会在试过之后编辑这个问题+1.谢谢你的观察。。
<a4j:commandButton onclick="fireAjax()"/>

<h:form>
   <a4j:jsFunction name="fireAjax" action=".."/>
</h:form>