struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgm <>
Subject Fwd: Theme problem after update to 2.3.16 -- loading parent theme templates?
Date Wed, 11 Dec 2013 23:40:23 GMT
To demonstrate the problem more clearly and help narrow down the issue, I
have removed everything custom and changed the application to use
"css_xhtml" theme like this:

    <constant name="struts.ui.templateDir" value="mx/themes"></constant>
    <constant name="struts.ui.theme" value="css_xhtml"></constant>

This causes this error to appear in the JBoss log file:

ERROR [template.FreemarkerTemplateEngine]  Could not load the FreeMarker
template named 'form':
ERROR [template.FreemarkerTemplateEngine]  Attempted:
ERROR [template.FreemarkerTemplateEngine]  The TemplateLoader provided by
the FreeMarker Configuration was a:
ERROR [components.ClosingUIBean]  Could not open template: Template /mx/themes/css_xhtml/form.ftl not

The problem seems to be that BaseTemplateEngine cannot read the file.  This method returns null:

    private InputStream tryReadingPropertyFileFromFileSystem(String

My "propFile" name is built up as "mx/themes/css_xhtml/" --
this file does exist at that path in my webapp root, but propFile.exists()
returns false on this JBoss 7 application server.  The file is definitely
there, but the relative path I specified in struts.ui.templateDir does not
appear to be searched with respect to the webapp's root.

Here's where JBoss puts it on my filesystem:


I don't know if it's appropriate to teach BaseTemplateEngine about
ServletContext.getRealPath.  It looks like I might have some success moving
my templates into the WEB-INF/classes folder such that I do not need to
rely on BaseTemplateEngine.tryReadingPropertyFileFromFileSystem and can
load it from the classloader instead.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message