使用 Netbeans 在 Glassfish 3.1.2.2 上部署 Web 应用程序,我的 h 标记均未显示在 Web 上。例如:
<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>
让我知道我是否可以提供更多信息。我在这方面很新...