1
votes

I have a trouble with my jsf page. I do not know how can make ajax render only when "input" not null or not empty.

Here is my code:

<h:inputText id="input" value="#{control.query}"/> 


<h:commandButton id="search" value="Search" action="#{control.getdata()}">
    <f:ajax execute="input" render="datatable"/>
</h:commandButton>

Thanks you!

1

1 Answers

4
votes

Make use of rendered attribute on the target.

<h:panelGroup id="datatable">
    <h:dataTable ... rendered="#{not empty control.query}">
        ...
    </h:dataTable>
</h:panelGroup>