0

New to this, so it might be simple.

I need the field to call a java bean method, every time something is entered/deleted. It should be doable like this, but it get the following error:

"<f:ajax> contains an unknown id 'input' - cannot locate it in the context of the component j_idt7"-

From what i know, the Ajax execute attribute="input" should make sure the instance variable "input" is updated.

This is relevant code in xhtml file:

<h:form>
        <div> Enter zipcode </div>
        <h:inputText >
            <f:ajax execute"input" render="out"> </f:ajax>
        </h:inputText>
        <h:outputText id="out"> #{postBean.by}</h:outputText>
    </h:form>
Anders
  • 719
  • 8
  • 22
  • The error points to another issue, i.e you're referencing to non defined id which is the value of `execute`'s attribute. Also, you've a "=" missing. – Omar Mar 25 '14 at 18:06
  • Ah i get it... how can set my instance variable #{postBean.input} via the text field, and then render the ooutputText? – Anders Mar 25 '14 at 18:11
  • Interesting: http://stackoverflow.com/questions/4801535/valuechangelistener-doubt-in-jsf/4802483#4802483 – Omar Mar 25 '14 at 18:40
  • As Omar said the `input` id is not defined, you cannot use the name of the tag, you can use `@this`, to execute the component containing `f:ajax`. Here you can find a comprehensive [jsf 2 ajax tutorial](http://mkblog.exadel.com/2010/04/learning-jsf-2-ajax-in-jsf-using-fajax-tag/) – landal79 Mar 27 '14 at 09:47

0 Answers0