未知标签JSF

时间:2013-07-31 02:02:47

标签: jsf

我无法查看InputText框,我收到一条错误,指示“未知标记(h:form)”和类似的错误h:inputtext

home.xhtml

<!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">
<head>
   <title>JSF Tutorial!</title>
</head>
<body>
   <h2>h:inputText example</h2>
   <hr />
   <h:form>
      <h3>Read-Only input text box</h3>
      <h:inputText value="Hello World!" readonly="true"/>
      <h3>Read-Only input text box</h3>
      <h:inputText value="Hello World"/>
   </h:form>
</body>
</html>

faces-config.xml中

<?xml version="1.0" encoding="UTF-8"?>
<faces-config
   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-facesconfig_2_0.xsd"
   version="2.0">
   <navigation-rule>
      <from-view-id>home.xhtml</from-view-id>

   </navigation-rule>   
</faces-config>

的web.xml     

   <web-app>
   <display-name>Archetype Created Web Application</display-name>

   <context-param>
      <param-name>javax.faces.PROJECT_STAGE</param-name>
      <param-value>Development</param-value>
   </context-param> 
   <context-param> 
      <param-name>javax.faces.CONFIG_FILES</param-name> 
      <param-value>/WEB-INF/faces-config.xml</param-value> 
   </context-param> 
   <servlet>
      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
   </servlet>
   <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.xhtm</url-pattern>
   </servlet-mapping>
</web-app>

JSF的API-2.1.7.jar JSF的IMPL-2.1.7.jar JSTL-1.2.jar

2 个答案:

答案 0 :(得分:1)

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"      
      xmlns:h="http://java.sun.com/jsf/html">

将HTML开头标记iwg替换为代码。这应该可以解决问题。

答案 1 :(得分:1)

<url-pattern>*.xhtm</url-pattern>

中的web.xml中有拼写错误

您的网页已回家了。 xhtml ,因此,它没有被Faces servlet处理