Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/312.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.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
Java Primefaces标记不起作用_Java_Jsf 2_Primefaces - Fatal编程技术网

Java Primefaces标记不起作用

Java Primefaces标记不起作用,java,jsf-2,primefaces,Java,Jsf 2,Primefaces,我正在尝试使用Eclipse3.6和GlassFish3.1作为应用服务器来启动PrimeFaces3.2开发 当我试图使用这个非常简单的代码从Eclipse发布我的应用程序时 <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

我正在尝试使用Eclipse3.6和GlassFish3.1作为应用服务器来启动PrimeFaces3.2开发

当我试图使用这个非常简单的代码从Eclipse发布我的应用程序时

<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"
    xmlns:p="http://primefaces.org/ui">

<ui:composition template="WEB-INF/template.xhtml">
    <ui:define name="content">
        <p:panel header="Login Form">
            <h:form>
                <p:button value="With Icon!" icon="bookmark" />
                <br />
                <p:spinner />
            </h:form>
        </p:panel>
    </ui:define>
</ui:composition>
</html>
更新:

对不起,这是我的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_3_0.xsd"
    version="3.0">
    <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>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
</web-app>

Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
/面孔/*
index.jsp
Facesservlet
*.jsf
我的模板

<!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:ui="http://java.sun.com/jsf/facelets">
<head>
  <title><ui:insert name="title">My Test Application</ui:insert></title>
</head>
<body>
<div id="header">
    <ui:insert name="header">
        <h1>Header</h1>
    </ui:insert>
</div>
<div id="content">
  <ui:insert name="content">

  </ui:insert>
</div>

<div id="footer">
  <ui:insert name="footer">
        <br/><br/>Footer!
  </ui:insert>
</div>
</body>
</html>

我的测试申请
标题


页脚!
例如,您需要在template.xhtml文件中进行以下更改

<f:view>
  <h:head>
   <title><ui:insert name="title">insert title</ui:insert></title>
   <meta content="text/html; charset=UTF-8" http-equiv="Content-type" />
   <link type = "text/css"  rel="stylesheet" href="/your/theme/skin.css" />
   </h:head>

插入标题

希望这对你有帮助

例如,您需要在template.xhtml文件中进行以下更改

<f:view>
  <h:head>
   <title><ui:insert name="title">insert title</ui:insert></title>
   <meta content="text/html; charset=UTF-8" http-equiv="Content-type" />
   <link type = "text/css"  rel="stylesheet" href="/your/theme/skin.css" />
   </h:head>

插入标题

希望这对你有帮助

错误消息表示您缺少视图中的
标记。尝试添加它。您是否将一些资源定位于
?web.xml中有什么?您需要配置一个
FacesServlet
,如中所述。问题就是Lion提到的。在模板中输入
。这将使PrimeFacesJavaScript得以呈现。嗨,我已经添加了所需的文件。你有什么想法吗?感谢在模板中添加jsf
而不是html
,也就是说,将html头标记替换为jsf标记。错误消息表示视图中缺少
标记。尝试添加它。您是否将一些资源定位于
?web.xml中有什么?您需要配置一个
FacesServlet
,如中所述。问题就是Lion提到的。在模板中输入
。这将使PrimeFacesJavaScript得以呈现。嗨,我已经添加了所需的文件。你有什么想法吗?谢谢在模板中添加jsf
,而不是html
,即用jsf标记替换html头标记谢谢。教程中没有提到这一点。Eclipse自动为我生成了这个文件。无论如何,感谢大家的响应。@MarkEstrada,我没有使用eclipse自动生成它。如果是这样的话,那就是一个bug。:)谢谢。教程中没有提到这一点。Eclipse自动为我生成了这个文件。无论如何,感谢大家的响应。@MarkEstrada,我没有使用eclipse自动生成它。如果是这样的话,那就是一个bug。:)