Good morning! Help solve the problem, pozhst. Event ajax code:

<h:form> <h:panelGroup class="form-group col-lg-8"> <label for="usr">Поиск:</label> <h:inputText class="form-control" id="searchParam" value="#{searchBeen.serchInput}" > </h:inputText> </h:panelGroup> <h:panelGroup class="form-group col-lg-3"> <label for="sel1">Поиск по:</label> <select class="form-control" id="sel1"> <option>Название</option> <option>Автор</option> </select> </h:panelGroup> <h:commandButton class="btn btn-default col-lg-1" style="margin-top: 23px;" value="Найти"> <f:ajax event="click" render=":booksContent" listener="#{booksList.formArrayListBySearch(searchBeen.serchInput)}"/> </h:commandButton> </h:form> 

Listener code for listener = "# {booksList.formArrayListBySearch (searchBeen.serchInput)}":

 public void formArrayListBySearch(String sp){ System.out.println("Отрабатывает функция поиска нужных книг : " + sp); } 

In the console we get:

Works out the search function for the right books:

Walking box input box filled

  • It seems impossible to pass the parameter booksList.formArrayListBySearch(searchBeen.serchInput) . You can do so except #{trader.buy('SOMESTOCK')} . Read: docs.oracle.com/javaee/7/tutorial/jsf-el003.htm#BNAHU - not a Programmer
  • Yes, apparently - it is impossible, thank you. And within the function, can you get to the value of this bean? - Ivan Zagorskiy
  • Yes, you can programmatically. If will be access. - not a Programmer
  • Did not say an important thing. The bin itself, in this case, will need to be received via FacesContext . Through new SearchBeen() it will not work, since you simply create a new object whose serchInput field will have a default value. And you also have several syntax errors: 1. SearchBeen - correctly Bean (bin), 2. serchInput - probably wanted searchInput . Although you may have conceived it =) - not a Programmer
  • I can’t figure out how to get to this Bin - Ivan Zagorskiy

1 answer 1

A call to methods with parameters was added in Expression Language 2.2. A container without EL2.2 support may be used or an earlier version is loaded.