how can I get a reference to a DIV (with a given id) from a jsf2 managed bean?
I've the following jsf template:
...
<h:body>
<p:tabView>
<p:tab title="Test">
<div id="top" class="top">
<ui:insert name="top"></ui:insert>
</div>
<div id="content" class="center_content">
<ui:insert name="content"></ui:insert>
</div>
</p:tab>
</h:body>
...
And this page:
<body>
<ui:composition template="./pagesTemplate.xhtml">
<ui:define name="top">
...
<h:form id="schedulingSearchForm">
...
<p:commandButton id="findButton"
value="Search"
action="#{searchSchedulingBean.executeSearch()}"
update="@form"
ajax="true"/>
</h:form>
</ui:define>
<ui:define name="content">
</ui:define>
</ui:composition>
</body>
I would like that when the button with id "findButton" is pressed the managed bean "searchSchedulingBean" executes the method "executeSearch" that performs a search and displays the result in a primefaces data table that will be inserted in the "content" section of the page ( or in the div with id "content" declared in the template).
This is the method of my managed bean that is executed when the button is pressed (I leave pseudocode) . How can I get from there the reference to "content"?
public void executeSearch() {
logger.info("Method executed");
//There I get the data from the database.
//But I don't know how get a reference to <ui:define name="content"> and create in it a new primefaces datatable to show that data.
}