我们正在从jsf 1.2升级到jsf 2,我们使用的是ApachemyFaces2.1和富faces 4.3。
问题是,似乎<a4j:commandButton>
标记AJAX功能被破坏了。下面是xhtml文件。
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:form prependId="false" id="questionsForm">
<!-- other form fields are not shown -->
<a4j:commandButton id="questions" value="Clear" action="#{bean.clearAction}"/>
</h:form>
</html>
当单击“清除”按钮时,后端代码将执行,但会发生整个页面重新加载(再次刷新页面)。在没有重新加载页面的情况下,预迁移代码工作得非常好。
任何人都可以帮助如何在富faces标记中实现AJAX工作吗?
发布于 2013-12-16 12:48:39
由于您必须告诉a4j:commandButton
的属性,
第一个是通过属性execute
完成的,最后一个是使用属性render
完成的。如果两者都没有给出,则按钮的行为类似于传统的h:commandButton
(这说明了所描述的行为)。
更新:还检查<head>
和<body>
标记必须与<h:head>
和<h:body>
类似,所以JSF有机会添加强制的javascript和css库。
更新:您是否再次检查了操作是否返回了void/""/null
,而没有任何转发?(另见"a4j:commandButton使整个页面重新加载RichFaces 3.3.3 CR1“)
https://stackoverflow.com/questions/20609004
复制相似问题