【发布时间】:2014-03-24 23:09:44
【问题描述】:
在为 Java EE http://docs.oracle.com/javaee/7/firstcup/doc/web-application005.htm 进行 firstcup-war 教程时,由于无法选择正确的 html 元素,因此未显示错误消息。我有以下代码:
<fc:inputDate id="userBirthday" date="#{dukesBDay.yourBD}" />
<h:outputText value=" #{bundle.Pattern}"/>
<p/>
<h:commandButton value="#{bundle.Submit}" action="#{dukesBDay.processBirthday}"/>
<p/>
<h:message for="userBirthday" style="color:red"/>
在浏览器中查看源代码时,我发现名称标签实际上是“j_idt6:userBirthday:j_idt16”。因此,如果我将上面发布的代码的最后一行更改为:
<h:message for="j_idt6:userBirthday:j_idt16" style="color:red"/>
它再次工作。为什么Java EE 在名称标签的开头和结尾处附加j_idt6 和j_idt16。以及为什么教程中的代码不起作用。我该怎么做才能让它工作,而不必检查源代码,实际的标签名称是什么样的。
【问题讨论】:
标签: java html reference enterprise