Ошибка JSF 2.1: исключение java.io.FileNotFoundException: * / *. Xhtml не найдено в ExternalContext - PullRequest
2 голосов
/ 30 сентября 2011

У меня есть ошибка в Jboss 7.0.2 "Arc", весенний веб-поток 2.3.0.RELEASE с richfaces 4.0.0.Final (Myfaces 2.1.1):

12: 34: 19,729 SEVERE [org.apache.myfaces.renderkit.ErrorPageWriter] (http - 127.0.0.1-8080-2) Произошло исключение: javax.faces.FacesException: java.io.FileNotFoundException: /sections/login/header.xhtmlНе найден в ExternalContext в качестве ресурса.

, когда я запускаю свою страницу login.xhtml:

<ui:composition template="/WEB-INF/flows/template/default.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich">

<ui:define name="windowTitle">
#{msgs.loginTitle}
</ui:define>

<ui:define name="heading">
<ui:include src="/sections/login/header.xhtml"/>
</ui:define>

<ui:define name="sidebarLeft">
<ui:include src="/sections/login/sidebarLeft.xhtml"/>
</ui:define>

<ui:define name="content">
<h:form>
   <h:panelGrid columns="2">
      #{msgs.namePrompt}
      <h:inputText id="name" value="#{user.name}"/>
      #{msgs.passwordPrompt}
      <h:inputSecret id="password" value="#{user.password}"/>
   </h:panelGrid>
   <p>
      <h:commandButton value="#{msgs.loginButtonText}"
                       action="planetarium"/>
   </p>
</h:form>
</ui:define>

Код файла header.xhtml:

  <html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:ui="http://java.sun.com/jsf/facelets"> 
  <!--  <head><title>IGNORED</title></head> -->
  <body>
  <ui:composition>
     <div class="header">
        #{msgs.loginHeading}
     </div>
  </ui:composition>
  </body>
  </html>

файл структуры выглядит следующим образом:

WEB-INF/flows/inscripcion
    inscripcion-flow.xhtml 
    inscripcion.xhtml    
    login.xhtml

WEB-INF/flows/sections/login
    header.xhtml
    sidebarLeft.xhtml

WEB-INF/flows/template
    template.xhtml

Почему возникла эта ошибка? Я прикрепил приглашение Jboss

https://rapidshare.com/files/817066879/log12.zip Спасибо.

1 Ответ

1 голос
/ 30 сентября 2011

Вы, кажется, поместили его в WEB-INF/flows/sections/login/header.xhtml.Исправьте src соответственно, чтобы соответствовать этому.

<ui:include src="/WEB-INF/flows/sections/login/header.xhtml"/>
...