简体   繁体   中英

JSF / Richfaces : how to retrieve the backing bean property that served as value for a inputtext

Hie all,

I have a complex form with a list of inputs (inputtext) that have been generated using a foreach over a backing bean property (list).

<c:forEach items="#{myBean.list}" var="elem">
<h:inputText value="#{elem.val}">
<a4j:ajax render="@this"/>
</h:inputText>
</c:forEach>

When one input is changed, I would like to know which one it was, so that I can proceed some immediate update on my model (ie call some update methods in a backing EJB). I have been looking through ValueChangeEvent, AjaxBehaviorEvent, IUComponent... but did not find where I cloud get a direct reference back to my backing property...

Is there a way to achieve this ?

Thanks for help

Did you try to add a a4j:support like this?

<c:forEach items="#{myBean.list}" var="elem">
   <h:inputText value="#{elem.val}">
      <a4j:ajax event="onchange" listner="#{someBean.changeValue(elem)}" render="@this"/>
   </h:inputText>
</c:forEach>

This way you can get, into the changeValue method, a reference to the element.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM