Is there any problem when I mix JSF with plain HTML?
I have the next co开发者_运维技巧de:
<li>
<h:form rendered="#{!loginController.session}">
<h3>Inicio de Sesión</h3>
<h:panelGrid columns="2" cellpadding="7">
<h:outputText value="Usuario: " />
<h:inputText id="loginname" value="#{loginController.loginname}" maxlength="16" />
<h:outputText value="Contraseña: " />
<h:inputSecret id="password" value="#{loginController.password}" maxlength="16"/>
<h:outputText value="" />
<h:commandButton value="Iniciar Sesión" action="#{loginController.CheckValidUser}" />
</h:panelGrid>
</h:form>
</li>
But when run that the page doesn't render the form, anybody can tell me why?
If you're using the ancient JSF 1.0/1.1 implementations, then you need to wrap HTML in <f:verbatim>
tags like so:
<f:verbatim><li></f:verbatim>
<h:form rendered="#{!loginController.session}">
<f:verbatim><h3>Inicio de Sesión</h3></f:verbatim>
<h:panelGrid columns="2" cellpadding="7">
...
Otherwise they will end up in the top of the generated document, before all JSF components.
If you're using a JSF 1.2 implementation or newer, then you should be able to write plain HTML in template text without problems since they are automatically taken as verbatim in the component tree. The only cause for the form not being rendered would be that LoginController#isSession()
returned true
since that's what its rendered
attribute is depending on.
精彩评论