2012-02-14 82 views
1

我正在使用JSF2.0和RichFaces 4.0.1 Final。我想防止页面重新加载事件发生。如何防止在Richfaces上的动作/事件中重新加载页面?

我的用例是:有一个隐藏式的命令按钮。我需要在Javascript中调用附加到它的事件。

问题:虽然我可以调用隐藏的按钮,但问题是,调用它时,页面会重新加载。我想阻止这个重新加载。

+0

请把你的代码。 你使用h:commandButton或a:commandButton – halil 2012-02-14 11:22:35

回答

2

只需使用AJAX:

<h:commandButton id="foo" action="#{bean.foo}" styleClass="hide"> 
    <f:ajax /> 
</h:commandButton> 

或者,因为你已经在使用的RichFaces:

<a4j:commandButton id="foo" action="#{bean.foo}" styleClass="hide" /> 
+0

感谢BalusC。它为我工作。 – 2012-02-15 05:03:05

+1

不客气。 – BalusC 2012-02-15 12:02:39

相关问题