2012-04-17 9 views
2

Eclipse 3.6 및 Glassfish 3.1을 사용하여 내 Primefaces 3.2 개발을 앱 서버로 시작하려고합니다.Primefaces 태그가 작동하지 않습니다.

이 간단한 코드를 사용하여 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> 

Primefaces가 렌더링되지 않습니다. 버튼이 보이지만 아이콘이없고 회 전자가 입력 텍스트 만 표시합니다.

잘 모르겠지만 primefaces jar 파일을 WEB-INF/lib 폴더에 넣었습니다.

글래스 피쉬 로그에서이 오류가 보이지만.

[#|2012-04-17T11:37:56.864+0800|INFO|glassfish3.1.2|javax.enterprise.resource.webcontainer.jsf.renderkit|_ThreadID=23;_ThreadName=Thread-2;|WARNING: FacesMessage(s) have been enqueued, but may not have been displayed. 
sourceId=null[severity=(ERROR 2), summary=(One or more resources have the target of 'head', but no 'head' component has been defined within the view.), detail=(One or more resources have the target of 'head', but no 'head' component has been defined within the view.)]|#] 

가 업데이트 : 여기

미안 내 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> 

내 템플릿 당신이 template.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" 
     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> 
+0

오류 메시지에 ''태그가 누락되었다고 표시됩니다. 그것을 추가하십시오. 일부 리소스를 ''(으)로 타겟팅 했습니까? – Lion

+0

'web.xml '에 무엇이 있습니까? [FacesServlet]을 구성해야합니다 (예 : [이 질문] (http://stackoverflow.com/q/3599015/139010)). –

+1

문제는 라이온이 언급 한 것입니다. 템플릿에 ''을 입력하십시오. 그러면 프라임 자막 JavaScript가 렌더링됩니다. –

답변

4

예 :

<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> 

희망이 도움이 될 것입니다.

+0

으로 바꿔 주셔서 감사합니다. 그것은 이것에 관한 튜토리얼에서 언급되지 않았습니다. 이클립스가 자동으로이 파일을 생성했습니다. 어쨌든, 응답에 감사드립니다. –

+0

@ MarkEstrada, 나는 그것을 자동 생성하기 위해 Eclipse를 사용하지 않았다. 그렇다면 버그 일 것이다. :) – UVM

관련 문제