使用 JSF 标签添加了文本框,但在屏幕上不可见
我有一个带有 JSF 标记的 Facelet 文件,用于显示标签、输入字段和按钮,但当我运行它时,这些部分在浏览器中不可见。
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title> supply a title</title>
</h:head>
<h:body>
<h:form>
Name:
<h:outputLabel value="First Name:"> </h:outputLabel>
<h:inputText id="name" value="#{DataForm.name}"></h:inputText>
<h:commandButton value="Doctor Register" action="#{DataForm.submit}"> </h:commandButton>
</h:form>
</h:body>
</html>
这是如何引起的以及如何解决?我正在使用 netbeans 6.9.1 Glassfish 3.1。
I have a Facelet file with JSF tags to display a label, an input field and a button, but those parts are are not visible in the browser when I run it.
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title> supply a title</title>
</h:head>
<h:body>
<h:form>
Name:
<h:outputLabel value="First Name:"> </h:outputLabel>
<h:inputText id="name" value="#{DataForm.name}"></h:inputText>
<h:commandButton value="Doctor Register" action="#{DataForm.submit}"> </h:commandButton>
</h:form>
</h:body>
</html>
How is this caused and how can I solve it? I am using netbeans 6.9.1 Glassfish 3.1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当未调用
FacesServlet
时,可能会发生这种情况。它负责解析 Facelet 文件并完成所有 JSF 工作。您需要确保您的请求 URL(您在浏览器地址栏中看到的 URL)与在
web.xml
FacesServlet 的 URL 模式匹配>。例如,如果它映射到*.jsf
的 URL 模式,那么您需要确保通过以下方式在浏览器中打开该页面或者当你想调用 < code>FacesServlet 在每个
*.xhtml
请求上,那么您需要相应地更改web.xml
中映射的 URL 模式(推荐)This can happen when the
FacesServlet
is not been invoked. It's the one responsible for parsing the Facelet file and doing all the JSF works.You need to ensure that your request URL (the one which you see in the browser address bar) matches the URL pattern of the
FacesServlet
as it is been mapped in theweb.xml
. If it's for example mapped on an URL pattern of*.jsf
, then you need to ensure that you open the page in browser byOr when you want to invoke the
FacesServlet
on every*.xhtml
request, then you need to change the URL pattern of the mapping inweb.xml
accordingly (recommended)