论坛首页 Java企业应用论坛

jsf中标签使用时遇到的一个小问题

浏览 2988 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2006-10-16  
由于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>
那么第一个按钮显示的值就会和第三个按钮显示的值一样,不会按照你自己的定义的标签显示
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics