RichFaces a4j:support should update the model in the context, but not the entity
Asked Answered
Q

1

6

i have an h:inputTextarea with some a4j:support to update the model on demand

<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>

My Problem is, that not only the model in my context is updated, when i press a key, but also the entity is flushed automatically!

the page.xml of this file has flushing-mode to manual

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

i read this post in the Seam Framework forum: Problems with AJAX and update model but this is not really helping. I also had some action in my a4j:support that makes a entityManager.refresh() as written in the post, but then the model and the entity was still on the old state...

Looking forward for some good hints, thanks!

(i use JSF 1.2, RichFaces 3.3.3)

Quiche answered 14/12, 2012 at 15:9 Comment(5)
can you describe little more? i think you need to use savestate.Tumor
@jubinPatel what infos you want exactly? i would like to help you answering the question, if you can tell me, what you kneed more... and: what you mean with savestate?Quiche
which entity goes null you mean input textarea value? also provide your JS. and savestate mean when full page reload then your backing bean customInput generate new object. to preserve last object use t:savestate. after <body> tag use <t:saveState value="#{customInput}"/> t tag for tomahawk lib. it may resolve problemTumor
we are not using tomahawk lib. no entity goes to null, the problem is, that an update of the model is autospersisting the entity... no save function is called! the setter function is a normal setter function...Quiche
Hi @Joerg, are you using a SEAM managed persistance context (@In EntityManager)? Also what is the scope of the customInput bean?Belittle
V
0

use reRender attribute for updating the model, what you do is mention the id of that in reRender attribute, you will get the result.

<a4j:support event="onchange" reRender="userRegistrationForm" action="#{UserRegistrationBean.onChangeMenuCountry}"></a4j:support>
Vassaux answered 6/3, 2013 at 6:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.