Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
分析XML时出错:未找到元素_Xml_Jsf_Jsf 2_Facelets - Fatal编程技术网

分析XML时出错:未找到元素

分析XML时出错:未找到元素,xml,jsf,jsf-2,facelets,Xml,Jsf,Jsf 2,Facelets,在学习JSF和尝试在浏览器中打开xhtml页面时,我经常遇到“解析XML时出错:找不到元素”的问题。为了修复它,我搜索了web和stackoverflow,但没有一个解决方案适合我 我是JSF新手,可能犯了一些新手错误。我的应用程序中的所有页面都出现问题,因此我认为我的web.xml可能不正确 应用服务器是JBoss,浏览器是Firefox,在Ubuntu 14.04上 以下是web.xml文件: <?xml version="1.0" encoding="UTF-8"?> <

在学习JSF和尝试在浏览器中打开xhtml页面时,我经常遇到“解析XML时出错:找不到元素”的问题。为了修复它,我搜索了web和stackoverflow,但没有一个解决方案适合我

我是JSF新手,可能犯了一些新手错误。我的应用程序中的所有页面都出现问题,因此我认为我的web.xml可能不正确

应用服务器是JBoss,浏览器是Firefox,在Ubuntu 14.04上

以下是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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>HomeLib</display-name>
  <welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
  </welcome-file-list>
  <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>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
</web-app>

家庭图书馆
index.xhtml
Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
/面孔/*
状态保存方法:“客户端”或“服务器”(=默认值)。参见JSF规范2.5.2
javax.faces.STATE_保存方法
客户
javax.faces.PROJECT_阶段
发展
javax.servlet.jsp.jstl.fmt.localizationContext
资源.应用
com.sun.faces.config.ConfigureListener
我的页面具有以下结构:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  

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

    <!-- here goes the content -->

    </h:html>  

我怀疑你称之为错误的方式

您在浏览器中的URL应为:

主机名:端口/项目名称/面模式

就你而言:

http://localhost:8080/HomeLib/faces/
这相当于:

http://localhost:8080/HomeLib/faces/index.xhtml

faces url模式(在您的情况下是/faces/*)是必要的,用于告诉服务器应该通过FacesServlet处理请求的url

您在浏览器中的URL应为:

主机名:端口/项目名称/面模式

就你而言:

http://localhost:8080/HomeLib/faces/
这相当于:

http://localhost:8080/HomeLib/faces/index.xhtml
faces url模式(在您的情况下为/faces/*)是必要的,用于告诉服务器应该通过FacesServlet处理请求的url