未呈现 JSF 标签 [英] JSF tags not rendered

查看:16
本文介绍了未呈现 JSF 标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 JSF 的新手,但我的 JSF 标签没有在 xhtml 文件中呈现,我尝试了所有可能的解决方案,但问题没有解决

I am new to JSF, but my JSF tags are not rendered in xhtml file, i tried out every possible solution, but problem is not solved

我的 web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>JSFProject</display-name>
  <welcome-file-list>
    <welcome-file>JSFProject/index.html</welcome-file>
    <welcome-file>JSFProject/index.htm</welcome-file>
    <welcome-file>JSFProject/index.jsp</welcome-file>
    <welcome-file>JSFProject/default.html</welcome-file>
    <welcome-file>JSFProject/default.htm</welcome-file>
    <welcome-file>JSFProject/default.jsp</welcome-file>
  </welcome-file-list>
  <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</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>*.xhtml</url-pattern>
  </servlet-mapping>
</web-app>

我的example.xhtml

my example.xhtml

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!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:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Example</title>
</head>
<body>
 <h:form>
    Some random data: <h:inputText/><br/>  <!-- Textfield ignored -->
    Some other data: <h:inputText/><br/>   <!-- Textfield ignored -->

    </h:form>

</body>
</html>

我花了 3 天时间找出问题,欢迎任何帮助

I had spend 3 days to figure out the problem, any help will be welcome

推荐答案

JSF 组件根本没有被解析的症状表明 FacesServlet 没有运行.当请求 URL 与 web.xml 中定义的 FacesServleturl-pattern 不匹配时,就会发生这种情况.这意味着 FacesServletactual url-pattern 根本不是 *.xhtml.您是否正在研究和编辑您认为正确的 web.xml ?是否将正确的 web.xml 与 webapp 一起部署到 servletcontainer 中?

The symptoms of the JSF components not being parsed at all indicates that the FacesServlet hasn't run. This will happen when the request URL doesn't match the url-pattern of the FacesServlet as definied in web.xml. This would mean that the actual url-pattern of the FacesServlet isn't *.xhtml at all. Are you looking into and editing the right web.xml you think you are? Is the right web.xml been deployed with the webapp into the servletcontainer?

这篇关于未呈现 JSF 标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆