使用Netbeans在Glassfish 3.1.2.2上部署web应用程序,并且我的h个标签都不会在Web上显示。例如:JSF h标签不显示
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
<head>
<title>Draft Savvy Beers</title>
</head>
<h:form>
<h:body>
<h1>Search for beers</h1>
<p><strong>Would you like to search for a beer?</strong>
<h:inputText value="#{draftSavvyController.searchTerm}" />
<h:commandButton value="#{draftSavvyController.searchforBeers}" /></p>
</h:body>
</h:form>
</html>
只显示文本,没有输入栏或按钮。使用普通的html显然会显示字段和按钮,但我无法以这种方式访问我的控制器。这是我的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>login.xhtml</welcome-file>
</welcome-file-list>
</web-app>
让我知道,如果我可以提供任何信息。我很新的这...
我希望你在CLASSPATH中添加正确的jsf相关库? – HashimR 2012-08-03 04:03:05
@HashimR我在项目中添加了JSF 2.1 jar(api和impl)。我是否也需要将它们添加到我的CLASSPATH环境变量中? – airowe 2012-08-03 04:05:03
不,它的好!... – HashimR 2012-08-03 04:05:52