这是我的表格:
<form action="j_security_check">
<h:panelGrid columns="2" bgcolor="#eff5fa" cellspacing="5" frame="box" styleClass="center">
<h:outputLabel value="User ID:"/>
<h:inputText id="j_username" tabindex="1" />
<h:outputLabel value="Password:"/>
<h:inputSecret id="j_password"/>
<h:outputLabel value=""/>
<h:commandButton id="login" value="Login"/>
</h:panelGrid>
</form>
Run Code Online (Sandbox Code Playgroud)
它适用于Glassfish 3.0.1,但是从Glassfish 3.1 b2开始,它FacesMessage
在JSF页面中显示了这个警告:
表单组件需要在其祖先中具有UIForm.建议:将必要的组件包含在内
<h:form>
如果我更改<form action="j_security_check">
为<h:form>
,它不会修复它,我必须放在<h:form>
里面<h:panelGrid>
.