RichFaces a4j:支持应该在上下文中更新模型,而不是实体

时间:2012-12-14 15:09:21

标签: richfaces jsf-1.2 ajax4jsf

我有h:inputTextarea一些a4j:support来按需更新模型

<h:inputTextarea rows="15" id="taFreetext" value="#{customInput.value}"
  required="true" 
  onkeyup="textAndLinesCount(#{rich:element('taFreetext')},document.getElementById('msgCounterLines'),20, 64);">
     <a4j:support ajaxSingle="true" event="onchange" />
</h:inputTextarea>

我的问题是,当我按下一个键时,不仅我的上下文中的模型被更新,而且实体也会自动刷新!

此文件的page.xml已将刷新模式设置为手动

<begin-conversation join="true" flush-mode="manual"/>

我在Seam框架论坛中阅读了这篇文章:Problems with AJAX and update model但这并没有真正帮助。 我的action中也有a4j:support个帖子中写有entityManager.refresh(),但模型和实体仍处于旧状态...

期待一些好的提示,谢谢!

(我使用JSF 1.2,RichFaces 3.3.3)

1 个答案:

答案 0 :(得分:0)

使用reRender属性来更新模型,你所做的就是在reRender属性中提到它的id,你将得到结果。

<a4j:support event="onchange" reRender="userRegistrationForm" action="#{UserRegistrationBean.onChangeMenuCountry}"></a4j:support>