我正在使用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的列表..
如何克服这个错误
答案 0 :(得分:1)
来自BalusC:“本身不生成任何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>