JSF2 - what scope for f:ajax elements?

Posted by Konrad Garus on Stack Overflow See other posts from Stack Overflow or by Konrad Garus
Published on 2010-03-23T19:06:58Z Indexed on 2010/03/23 20:03 UTC
Read the original article Hit count: 737

Filed under:
|

I have this form:

<h:form>
    <h:outputText value="Tag:" />   
    <h:inputText value="#{entryRecorder.tag}">
        <f:ajax render="category" />
    </h:inputText>
    <h:outputText value="Category:" />
    <h:inputText value="#{entryRecorder.category}" id="category" />
</h:form>

What I'm trying to achieve: When you type in the "tag" field, the entryRecorder.tag field is updated with what was typed. By some logic upon this action the bean also updates its category field. This change should be reflected in the form.

Questions:

  1. What scope shall I use for EntryRecorder? Request may not be satisfactory for multiple AJAX requests, while session will not work with multiple browser windows per one session.
  2. How can I register my updateCategory() action in EntryRecorder so that it is triggered when the bean is updated?

© Stack Overflow or respective owner

Related posts about jsf2

Related posts about AJAX