javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-1189

#{resource['...']} not usable in <ui:composition template="..."

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.0.0-BETA1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      1,189
    • Status Whiteboard:
      Hide

      size_medium importance_meduim

      Show
      size_medium importance_meduim

      Description

      I want to organize a Facelets template page and its parts just as other
      resources (like style sheets and images).

      However, when I have this definition:
      <ui:composition 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"
      template="#

      {resource['layout:template.xhtml']}

      ">...

      Then I get this stacktrace:
      ERROR [/hska].[jsfServlet] - Servlet.service() for servlet jsfServlet threw
      exception
      javax.faces.view.facelets.TagAttributeException: /bestellverwaltung/listBestellu
      ngen.xhtml @5,56 <ui:composition template="#

      {resource ['layout:template.xhtml']}

      "> Invalid
      path : /hska/faces/javax.faces.resource/template.xhtml?ln=layout
      at com.sun.faces.facelets.tag.ui.CompositionHandler.apply
      (CompositionHandler.java:154)
      at com.sun.faces.facelets.compiler.NamespaceHandler.apply
      (NamespaceHandler.java:82)
      at com.sun.faces.facelets.compiler.EncodingHandler.apply
      (EncodingHandler.java:75)
      at com.sun.faces.facelets.impl.DefaultFacelet.apply
      (DefaultFacelet.java:130)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView
      (FaceletViewHandlingStrategy.java:756)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute
      (RenderResponsePhase.java:106)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:311)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
      (ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter
      (ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke
      (StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke
      (StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke
      (StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke
      (ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke
      (StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service
      (CoyoteAdapter.java:293)
      at org.apache.coyote.http11.Http11AprProcessor.process
      (Http11AprProcessor.java:859)
      at
      org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process
      (Http11AprProtocol.java:574)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run
      (AprEndpoint.java:1527)
      at java.lang.Thread.run(Thread.java:619)

        Issue Links

          Activity

          Hide
          Ryan Lubke added a comment -

          #

          {resource}

          expressions ultimately return the result of
          ResoureHandler.getRequestPath() which is a URL that a user-agent can request.
          As such, this type of expression isn't intended for use with includes or
          compositions.

          Show
          Ryan Lubke added a comment - # {resource} expressions ultimately return the result of ResoureHandler.getRequestPath() which is a URL that a user-agent can request. As such, this type of expression isn't intended for use with includes or compositions.
          Hide
          fkj added a comment -

          I was very frustrated to see that it doesn't works. I have lot's of projects
          that share the same templates.

          Can't this be considered as an enhancement?

          Thanks a lot,
          Felipe

          Show
          fkj added a comment - I was very frustrated to see that it doesn't works. I have lot's of projects that share the same templates. Can't this be considered as an enhancement? Thanks a lot, Felipe
          Hide
          Ed Burns added a comment -

          Move to 2.2, and assign to me.

          Show
          Ed Burns added a comment - Move to 2.2, and assign to me.
          Hide
          blee1223 added a comment -

          Is there a workaround or a method to reference an xhtml page that is packaged in a jar. I would like to use ui:include and have it reference an xhtml page that is in a jar.

          Show
          blee1223 added a comment - Is there a workaround or a method to reference an xhtml page that is packaged in a jar. I would like to use ui:include and have it reference an xhtml page that is in a jar.
          Hide
          blee1223 added a comment -

          Sorry,

          I want to explain what I am trying to do to give you insight on what I am trying to accomplish.

          I want to be able to load a template dynamically at runtime based on the type of object I am trying to display.

          For example, lets say I have a fictional-book.xhtml template that displays fictional book information and a romantic-book.xhtml template that displays attributes of a romantic book. These .xhtml files are packaged in a jar because I can use them across several applications. At runtime in one of my web-apps, I would like the user to be able to select the book type they want to see, i.e. fictional or romantic from a dropdown on the gui and have it display the corresponding xhml information. How would I accomplish this?

          I thought xhtml pages could be served up as a resource and passed to ui:include but the exception javax.faces.view.facelets.TagAttributeException occurs.

          Is there a way to accomplish this?

          Thanks in advance.

          Show
          blee1223 added a comment - Sorry, I want to explain what I am trying to do to give you insight on what I am trying to accomplish. I want to be able to load a template dynamically at runtime based on the type of object I am trying to display. For example, lets say I have a fictional-book.xhtml template that displays fictional book information and a romantic-book.xhtml template that displays attributes of a romantic book. These .xhtml files are packaged in a jar because I can use them across several applications. At runtime in one of my web-apps, I would like the user to be able to select the book type they want to see, i.e. fictional or romantic from a dropdown on the gui and have it display the corresponding xhml information. How would I accomplish this? I thought xhtml pages could be served up as a resource and passed to ui:include but the exception javax.faces.view.facelets.TagAttributeException occurs. Is there a way to accomplish this? Thanks in advance.
          Hide
          Ed Burns added a comment -

          This is being handled in JSF 2.2.

          Show
          Ed Burns added a comment - This is being handled in JSF 2.2.

            People

            • Assignee:
              Ed Burns
              Reporter:
              juergen_zimmermann
            • Votes:
              12 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: