将JSF与纯HTML混合使用时有什么问题吗? [英] Is there any problem when I mix JSF with plain HTML?
问题描述
我有下一个代码:
< li>
< h:表单呈现=#{!loginController.session}>
< h3> Inicio de Sesi& oacute; n< / h3>
< h:panelGrid columns =2cellpadding =7>
< h:outputText value =Usuario:/>
< h:inputText id =loginnamevalue =#{loginController.loginname}maxlength =16/>
< h:outputText value =Contrase& ntilde; a:/>
< h:inputSecret id =passwordvalue =#{loginController.password}maxlength =16/>
< h:outputText value =/>
< h:commandButton value =Iniciar Sesi& oacute; naction =#{loginController.CheckValidUser}/>
< / h:panelGrid>
< / h:表格>
< / li>
但是当运行页面不显示窗体时,任何人都可以告诉我为什么?如果您使用的是古老的JSF 1.0 / 1.1实现,那么您需要在<<< ; f:verbatim>
这样的标签:
< f:verbatim>< li> < / F:逐字>
< h:表单呈现=#{!loginController.session}>
< f:verbatim>< h3> Inicio de Sesi& oacute; n< / h3>< / f:verbatim>
< h:panelGrid columns =2cellpadding =7>
...
否则它们将在生成的文档的顶部<所有JSF组件之前。
如果您使用的是JSF 1.2或更新的实现,那么您应该能够在模板文本中编写纯HTML没有问题,因为它们在组件树中被自动视为逐字记录。表单不被呈现的唯一原因是 true
,因为这就是它的呈现
属性取决于。
I have the next code:
<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.
这篇关于将JSF与纯HTML混合使用时有什么问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!