我正在使用jsf 2.0和ajax,当我从下拉框中选择项目时,我希望它从showTime列表中显示项目
xhtml文件: <tr>
<td>Movies:</td>
<td>
<h:selectOneMenu value="#{locationBean.movie}"
disabled="#{locationBean.movieListDisabled}"
id="movieList">
<f:selectItems value="#{locationBean.movies}"/>
<f:ajax render="showTime"/>
</h:selectOneMenu></td>
</tr>
<tr>
<td>Availablity:</td>
<td>
<ui:repeat value="#{locationBean.showTime}" var="item" id="showTime">
<div><h:inputText value="#{item.value}" id="showTime"/></div>
</ui:repeat>
</td>
</tr>
和从bean返回showTiming ..的列表
如何克服这个错误
From BalusC: "the本身不生成任何HTML,因此JS/Ajax无法在HTML中找到任何东西来更新/渲染"
试试这样写:
<tr>
<td>Movies:</td>
<td>
<h:selectOneMenu value="#{locationBean.movie}" disabled="#{locationBean.movieListDisabled}" id="movieList">
<f:selectItems value="#{locationBean.movies}"/>
<f:ajax event="change" render="showTimePanel"/>
</h:selectOneMenu>
</td>
</tr>
<tr>
<td>Availablity:</td>
<td>
<h:panelGroup id="showTimePanel">
<ui:repeat value="#{locationBean.showTime}" var="item">
<div><h:inputText value="#{item.value}"></div>
</ui:repeat>
</h:panelGroup>
</td>
</tr>