如何从jsf2托管bean获取对DIV(具有给定id)的引用?
我有以下jsf模板:
...
<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>
...
这页:
<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>
我希望当按下id为“findButton”的按钮时,托管bean“searchSchedulingBean”执行执行搜索的方法“executeSearch”,并将结果显示在将插入“内容”的primefaces数据表中“页面的一部分(或在模板中声明为id”content“的div)。
这是我按下按钮时执行的托管bean的方法(我留下伪代码)。 我如何从那里得到“内容”的引用?
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.
}