Beehive
  1. Beehive
  2. BEEHIVE-199

Cannot reference Tiles Definition files outside the current page flow using relative paths.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: V1Beta
    • Fix Version/s: v1m1
    • Component/s: NetUI
    • Labels:
      None
    • Environment:
      Running the usual components required by Beehive V1Beta on a Win32 box. Local test environment.

      Description

      Cannot reference Tiles Definition files outside the current page flow when using relative paths.

      Example use-case 1 (nested page flow):
      ---------------------------------------
      Reference a tiles definition file from within a nested page flow where the tiles definition file lives in the parent page flow directory (one directory above) like so:

      @Jpf.Controller(
      tilesDefinitionsConfigs =

      { "../tiles-defs.xml" }

      ,
      simpleActions=

      { @Jpf.SimpleAction(name="begin", tilesDefinition="default.page") }

      )

      Which does not work because the generated output would look like this:

      <plug-in className="org.apache.struts.tiles.TilesPlugin">
      <set-property property="definitions-config" value="\nested/../tilesdefs.xml"/>
      <set-property property="moduleAware" value="true"/>
      </plug-in>

        Activity

        Nathan Jantz created issue -
        Julie Zhuo made changes -
        Field Original Value New Value
        Assignee carlin rogers [ crogers ]
        Jeremiah Johnson made changes -
        Summary Cannot reference Tiles Definition files outside the current page flow. Cannot reference Tiles Definition files outside the current page flow using relative paths.
        Description Cannot reference Tiles Definition files outside the current page flow. This goes for both nested page flows and inherited ones.

        Example use-case 1 (nested page flow):
        ---------------------------------------
        Reference a tiles definition file from within a nested page flow where the tiles definition file lives in the parent page flow directory (one directory above) like so:

        @Jpf.Controller(
            tilesDefinitionsConfigs = { "../tiles-defs.xml" },
            simpleActions={
                @Jpf.SimpleAction(name="begin", tilesDefinition="default.page")
            }
        )

        Which does not work because the generated output would look like this:

        <plug-in className="org.apache.struts.tiles.TilesPlugin">
            <set-property property="definitions-config" value="\nested/../tilesdefs.xml"/>
            <set-property property="moduleAware" value="true"/>
        </plug-in>


        Example use-case 2 (inherited page flow):
        ------------------------------------------

        ParentPageFlow.jpf:
        @Jpf.Controller(
            tilesDefinitionsConfigs = { "tiles-defs.xml" },
            simpleActions={
                @Jpf.SimpleAction(name="begin", tilesDefinition="default.page")
            }
        )

        ChildPageFlow.jpf (extends ParentPageFlow):
        ChildFlow1Controller.jpf:
        @Jpf.Controller(
            simpleActions={
                @Jpf.SimpleAction(name="begin", tilesDefinition="default.page")
            }
        )

        Generated struts-config output:
        <plug-in className="org.apache.struts.tiles.TilesPlugin">
            <set-property property="definitions-config" value="\childFlow1/tiles-defs.xml"/>
            <set-property property="moduleAware" value="true"/>
        </plug-in>

        Reference to tiles-defs.xml is incorrect. tiles-defs.xml lives in the ParentPageFlow directory. ChildPageFlow should of inherited the correct path.

        This currently limits how tiles can be set up within nested page flows or inherited page flows. In other words, the current PF implementation doesn't support sharing of one common tiles definition file (tiles-defs.xml) among nested or inherited page flows. It requires multiple tiles definitions and JSP tiles to live in different places within the same webapp.


        Cannot reference Tiles Definition files outside the current page flow when using relative paths.

        Example use-case 1 (nested page flow):
        ---------------------------------------
        Reference a tiles definition file from within a nested page flow where the tiles definition file lives in the parent page flow directory (one directory above) like so:

        @Jpf.Controller(
            tilesDefinitionsConfigs = { "../tiles-defs.xml" },
            simpleActions={
                @Jpf.SimpleAction(name="begin", tilesDefinition="default.page")
            }
        )

        Which does not work because the generated output would look like this:

        <plug-in className="org.apache.struts.tiles.TilesPlugin">
            <set-property property="definitions-config" value="\nested/../tilesdefs.xml"/>
            <set-property property="moduleAware" value="true"/>
        </plug-in>
        Hide
        Carlin Rogers added a comment -

        This seems to work OK. The tiles definition config
        file is loaded during the tiles plugin processing
        and the definitions are stored. The example application
        may not work because the JSP files provided in the
        tiles definitions may not have been located by the
        app at run time. This depends on how the paths to the
        JSPs are defined in the definitions.

        The tiles insert tag uses a PageContext.include().
        So a layout or template JSP that uses an insert needs
        a path that is either relative from this PageContext
        to the JSP to include or is an absolute path from
        the web app root.

        E.g. For a definition with a template JSP
        <definition name="defaultLayout"
        path="/tiles/jsp/layout/default.jsp">

        any included pages must be relative to the default.jsp
        file or absolute from the web app. Either something like

        <put name="body" value="../../pf/mainBody.jsp" />
        or
        <put name="body" value="/tiles/pf/mainBody.jsp" />

        To avoid confusion, I will add code to normalize the
        path to avoid any confusion. Leaving this open for now.

        Show
        Carlin Rogers added a comment - This seems to work OK. The tiles definition config file is loaded during the tiles plugin processing and the definitions are stored. The example application may not work because the JSP files provided in the tiles definitions may not have been located by the app at run time. This depends on how the paths to the JSPs are defined in the definitions. The tiles insert tag uses a PageContext.include(). So a layout or template JSP that uses an insert needs a path that is either relative from this PageContext to the JSP to include or is an absolute path from the web app root. E.g. For a definition with a template JSP <definition name="defaultLayout" path="/tiles/jsp/layout/default.jsp"> any included pages must be relative to the default.jsp file or absolute from the web app. Either something like <put name="body" value="../../pf/mainBody.jsp" /> or <put name="body" value="/tiles/pf/mainBody.jsp" /> To avoid confusion, I will add code to normalize the path to avoid any confusion. Leaving this open for now.
        Hide
        Carlin Rogers added a comment -

        The patch and resolution for JIRA Beehive issue 217 will
        require that the paths to tiles definition files be absolute
        from the webapp root. That will make this bug a non-issue.
        I will change this bug to "resolved" once we get the patch
        provided for 217 into svn.

        Show
        Carlin Rogers added a comment - The patch and resolution for JIRA Beehive issue 217 will require that the paths to tiles definition files be absolute from the webapp root. That will make this bug a non-issue. I will change this bug to "resolved" once we get the patch provided for 217 into svn.
        Hide
        Carlin Rogers added a comment -

        Addressed with revision 157848. An absolute path from the
        webapp root is required for the location of the tiles
        definitions config files.

        Show
        Carlin Rogers added a comment - Addressed with revision 157848. An absolute path from the webapp root is required for the location of the tiles definitions config files.
        Carlin Rogers made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s V1 [ 10780 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Carlin Rogers [ crogers ] Nathan Jantz [ njantz ]
        Hide
        Nathan Jantz added a comment -

        Related to BEEHIVE-217. Updating qaWeb Tiles support test suite accordingly. Closing issue.

        Show
        Nathan Jantz added a comment - Related to BEEHIVE-217 . Updating qaWeb Tiles support test suite accordingly. Closing issue.
        Nathan Jantz made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Nathan Jantz
            Reporter:
            Nathan Jantz
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development