Struts 2
  1. Struts 2
  2. WW-1291

Centralize location for all template files include JavaScript

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: WW 2.2.2
    • Fix Version/s: 3.0
    • Component/s: Plugin - Tags
    • Labels:
      None

      Description

      Currently, WebWork loads the FTL files from either the JAR or the template directory in the web application. However, it loads the JavaScript files from the classpath using a prefix based search. This forces custom JavaScript files to be placed into the WEB-INF/classes/template directory rather than with the custom FTL files in the web application directory. These two ways to customize WebWork should be combined so that it is all standard.

        Activity

        Hide
        Brian Pontarelli added a comment -

        It has been far too long for me to recall all the details on this issue. The only thing that I can recall is that the search path for FTL files is different than those for JS files. If WebWork is looking for a template it looks in the /template/<theme> for overrides and then in classpath. When it looks for JS files it searches the classpath only. So, overrides need to be placed in the /WEB-INF/classes directory since this ends up in the web application classpath prior to the webwork JAR files.

        I see your point about changing the JS URL in the FTL file to NOT use the /struts namespace, but if I want to use a theme (say XHTML) and don't need to tweak it at all, it would be nice to have the ability to override JS files in the same manner as I can override FTL files, by placing them in the /template/<theme> and it searches there first and then falls back to the classpath. This would standardize the override method for both types of files.

        Show
        Brian Pontarelli added a comment - It has been far too long for me to recall all the details on this issue. The only thing that I can recall is that the search path for FTL files is different than those for JS files. If WebWork is looking for a template it looks in the /template/<theme> for overrides and then in classpath. When it looks for JS files it searches the classpath only. So, overrides need to be placed in the /WEB-INF/classes directory since this ends up in the web application classpath prior to the webwork JAR files. I see your point about changing the JS URL in the FTL file to NOT use the /struts namespace, but if I want to use a theme (say XHTML) and don't need to tweak it at all, it would be nice to have the ability to override JS files in the same manner as I can override FTL files, by placing them in the /template/<theme> and it searches there first and then falls back to the classpath. This would standardize the override method for both types of files.
        Hide
        Don Brown added a comment -

        Moving to future as it needs more discussion

        Show
        Don Brown added a comment - Moving to future as it needs more discussion
        Hide
        Don Brown added a comment -

        I'm not sure I follow, actually. JS and other static files are only loaded from the classpath when prefixed by "/struts". If you don't want that behavior, then just reference the file directly, without the "/struts" prefix.

        Show
        Don Brown added a comment - I'm not sure I follow, actually. JS and other static files are only loaded from the classpath when prefixed by "/struts". If you don't want that behavior, then just reference the file directly, without the "/struts" prefix.
        Hide
        Don Brown added a comment -

        I'll take a look at this for the 2.0.1 release

        Show
        Don Brown added a comment - I'll take a look at this for the 2.0.1 release

          People

          • Assignee:
            Don Brown
            Reporter:
            Brian Pontarelli
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development