繁体   English   中英

未知标签JSF

[英]Unknown tag 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

<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。 这应该可以解决问题。

您在web.xml <url-pattern>*.xhtm</url-pattern>中有错字

您的主页是首页。 xhtml ,因此,Faces servlet不处理它

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM