我在我的jsp中为多个表单字段指定了h:消息。登录时,将验证会话并将字段替换为注销。登录正确,但未显示字段验证。我还有一个全局h:消息来显示服务器错误。
<c:when test="${userId==null}">
<div id="fields" class="fieldclass" style="display: none" >
<div id="sqlserver" class="sqlserver" >
<h:panelGrid id="grid2"
columns="2" >
<h:outputLabel value="Host" styleClass="outputLabel" id="label5"></h:outputLabel>
<h:inputText id="host" value="#{userBean.host}" required="true" requiredMessage="Host Name is Mandatory"></h:inputText>
<h:outputText value="User ID"></h:outputText>
<h:inputText id="useid" value="#{userBean.userId}" required="true" requiredMessage="User Name is Mandatory"></h:inputText>
<h:outputText value="Password"></h:outputText>
<h:inputSecret id="pwd" value="#{userBean.password}" required="true" requiredMessage="Password is Mandatory"/><h:inputSecret>
<h:message for="host" style="font-weight: bold; color :red; "></h:message>
<h:message for="useid" style="font-weight: bold; color :red; "></h:message>
<h:message for="pwd" style="font-weight: bold; color :red; "></h:message>
</c:when>
<c:otherwise>
<center>
<h:outputText id="logintext">You have successfully logged in!!</h:outputText>
<br>
<h:commandLink action="#{userBean.logout}" value="Logout" ></h:commandLink>
</center>
</c:otherwise>
即使是控制台也没有拿到验证。我做错了什么?