为什么联系表单会让我的页脚消失?
我构建了这个联系表单,如果我单独运行它,效果会很好,但是如果我放在联系页面上,会使我的页脚消失,我真的不知道为什么会发生这种情况,我真的需要帮助。
contact.xhtml
<!DOCTYPE html>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j">
<h:form id="contact">
<h:panelGrid columns="3">
<h:outputLabel for="name" value="Nome (Obrigatório)" />
<h:inputText id="name" value="#{contact.client.name}" />
<h:message for="name" />
<h:outputLabel for="email" value="E-Mail (Obrigatório)" />
<h:inputText id="email" value="#{contact.client.email}" />
<h:message for="email" />
<h:outputLabel for="website" value="Website (Opcional)" />
<h:inputText id="website" value="#{contact.client.website}" />
<h:message for="website" />
</h:panelGrid>
<h:outputLabel for="text" value="Mensagem (Obrigatório):" /> <br/>
<h:inputTextarea id="text" value="#{contact.client.text}" rows="20" cols="80" /><br/>
<h:message for="text" />
<br/>
<h:commandButton value="Enviar" action="#{contact.sendMessage}" >
<f:ajax execute="@form" render="@form" />
</h:commandButton>
<h:outputText value="#{contact.messageStatus}" id="out" />
<a4j:status>
<f:facet name="start">
<h:graphicImage name="loader.gif" library="image" />
<h:outputText value="Enviando ..." />
</f:facet>
</a4j:status>
</h:form>
</ui:composition>
如果没有组件“contact.xhtml”,它看起来像:
使用组件(并且没有页脚):
知道为什么会发生这种情况吗? 有什么帮助吗?
更新 我在这里托管页面,大家可以看一下。
I build this contact form, which works perfectly if I run it alone, but if I put on my contact page make my footer disappear, I really don't know why this is happening, I really need help with this.
contact.xhtml
<!DOCTYPE html>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j">
<h:form id="contact">
<h:panelGrid columns="3">
<h:outputLabel for="name" value="Nome (Obrigatório)" />
<h:inputText id="name" value="#{contact.client.name}" />
<h:message for="name" />
<h:outputLabel for="email" value="E-Mail (Obrigatório)" />
<h:inputText id="email" value="#{contact.client.email}" />
<h:message for="email" />
<h:outputLabel for="website" value="Website (Opcional)" />
<h:inputText id="website" value="#{contact.client.website}" />
<h:message for="website" />
</h:panelGrid>
<h:outputLabel for="text" value="Mensagem (Obrigatório):" /> <br/>
<h:inputTextarea id="text" value="#{contact.client.text}" rows="20" cols="80" /><br/>
<h:message for="text" />
<br/>
<h:commandButton value="Enviar" action="#{contact.sendMessage}" >
<f:ajax execute="@form" render="@form" />
</h:commandButton>
<h:outputText value="#{contact.messageStatus}" id="out" />
<a4j:status>
<f:facet name="start">
<h:graphicImage name="loader.gif" library="image" />
<h:outputText value="Enviando ..." />
</f:facet>
</a4j:status>
</h:form>
</ui:composition>
Without the componet 'contact.xhtml' it looks like:
With the component (and without the footer):
Any idea why this is happening ?
Any help ?
UPDATE
I host the page here guys, so you could take a look at it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我检查了页面的 HTML 源代码(在浏览器中右键单击页面,查看源代码),在底部我看到未解析的 JSF 标记:
然后所有 HTML 都停在那里。
显然您忘记声明
a4j
的 XML 命名空间,HTML 渲染器生气了。然而这本应在开发阶段发出明确的警告。将以下上下文参数添加到您的
web.xml
中,以便更快地收到有关此类未来错误的通知:I checked the HTML source of your page (rightclick page in browser, View Source), at the bottom I see unparsed JSF tags:
and then all the HTML stops there.
Apparently you forgot to declare the XML namespace for
a4j
and the HTML renderer got mad.This should in development stage however have issued a clear warning. Add the following context parameter to your
web.xml
to be notified sooner on this kind of future mistakes:由于没有代码可看,我只能猜测:表单或页脚的边距。
Since there is no code to look at, I can only guess: margins of the form or the footer.