日期:2014-05-16  浏览次数:20351 次

jsf中标签使用时遇到的一个小问题
由于jsf中标签都是使用id来识别的,因此在jsf中标签最好给id取一个名字,否则很可能会出现一些问题
比如:下面这段程序
<td>
<c:if test="${FLAG}">
<h:commandButton id="dfdf" value="#{msg['unsalable.save.approve']}" action=""></h:commandButton>
<h:commandButton id="ddd" value="#{msg['unsalable.cancel.buhuo']}" action=""></h:commandButton>
</c:if>
<c:if test="${!FLAG}">
<h:commandButton id="ff" value="#{msg['unsalable.out.addPage.cancel']}"></h:commandButton>
</c:if>
</td>

如果第一个按钮的id和第三个按钮的id没有标识,那么
<c:if test="${!FLAG}">
<h:commandButton id="ff" value="#{msg['unsalable.out.addPage.cancel']}"></h:commandButton>
</c:if>

显示后再显示
<c:if test="${FLAG}">
<h:commandButton id="dfdf" value="#{msg['unsalable.save.approve']}" action=""></h:commandButton>
<h:commandButton id="ddd" value="#{msg['unsalable.cancel.buhuo']}" action=""></h:commandButton>
</c:if>
那么第一个按钮显示的值就会和第三个按钮显示的值一样,不会按照你自己的定义的标签显示