struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: struts 2.3.16 custom (sub-classed) theme issue
Date Fri, 24 Jan 2014 07:29:35 GMT
osm!

Yes, there was bug in 2.3.16 and previous - template folder had to be
put on classpath (src/main/resources/) as ThemeManager was looking for
theme.properties only using classpath. I have extended that and now
(as from 2.3.17 - not released yet) you can put it in webapps as well.

See https://issues.apache.org/jira/browse/WW-4260


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

2014/1/24 adam brin <abrin@digitalantiquity.org>:
> Hi Lukasz,
>   Just to follow-up, I *think* I identified the problem... I just don't
> understand why.  The issue is that our template directory is in
> src/main/webapps/ and not src/main/resources/ . Is it possible that this is
> a bug in how the UIBean resolves paths?  When we move the directory the
> errors for struts2 looking for template/~~~tdar/css.ftl go away.  Is it
> possible that there's a relative directory reference or some other
> assumption in how/where it looks for different themes?
>
> - adam
>
>
> On Thu, Jan 23, 2014 at 8:15 AM, adam brin <adam.brin@asu.edu> wrote:
>
>> Hi Lukasz,
>>   Our case is slightly different... we have about 10 files in our theme.
>> None of our theme files reference a local version of css.ftl. But to reduce
>> the problem to its simplest, if we remove everything from
>> src/main/webapp/template/tdar/ except for theme.properties and
>> textarea.ftl, we still get the error.  Finally, if we change the
>> textarea.ftl to comment out the controlheader and controlfooter references:
>>
>> <#-- <#include
>> "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" /> -->
>> <#include "/${parameters.templateDir}/simple/textarea.ftl" />
>> <#-- <#include
>> "/${parameters.templateDir}/${parameters.theme}/controlfooter.ftl" /> -->
>>
>>
>> we still see:
>>
>> The failing instruction (print stack trace for 1 more):
>> ==> #include "/\${parameters.templateDir}...  [in template
>> "template/simple/textarea.ftl" at line 42, column 1]
>>
>>  ...
>> Caused by: freemarker.core._MiscTemplateException: Error reading included
>> file "template/~~~tdar/css.ftl":
>> Template "template/~~~tdar/css.ftl" not found.
>>
>>
>> Any thoughts? I'm not sure how to pair down our theme any more than it
>> already is to isolate what's wrong.
>>
>>  thanks,
>>
>> adam
>>
>>
>> On Wed, Jan 22, 2014 at 11:41 PM, Lukasz Lenart <lukaszlenart@apache.org>wrote:
>>
>>> As I understand you have created a custom theme with only one template
>>> - textarea.ftl and there isn't neither controlheader.ftl nor
>>> controlfooter.ftl in your them?
>>>
>>> If so, you must use ${parameters.expandTheme} instead of
>>> ${parameters.theme} to tell ThemeManager to check current theme and
>>> then parent theme. If you add these two templates at some point,
>>> ThemeManager will pick theme up automatically.
>>>
>>> Another example:
>>> If you want to only change controlheader.ftl/controlfooter.ftl (and
>>> you don't want to touch textarea.ftl), you can simple define them in
>>> your theme and textarea.ftl from xhtml theme will pick them up as well
>>> (when there be no theme attribute defined, in other case, templates
>>> from pointed out theme will be used instead).
>>>
>>> Hope that helps :-)
>>>
>>>
>>> Regards
>>> --
>>> Łukasz
>>> + 48 606 323 122 http://www.lenart.org.pl/
>>>
>>>
>>> 2014/1/22 adam brin <abrin@digitalantiquity.org>:
>>> > This is related to WW-4145, I think.
>>> >
>>> > When upgrading to 2.3.16, we're receiving the following error messages
>>> for
>>> > our locally created theme.  This theme builds off of the simple theme,
>>> but
>>> > mostly includes "custom" controlheader and controlfooter elements. The
>>> > issue we're seeing is that struts seems to be looking for "inherited"
>>> files
>>> > (e.g. css.ftl from the simple theme) in our custom theme instead of the
>>> > parent theme (in our case simple).
>>> >
>>> > This only happens when we use two input themes on the same page:
>>> >
>>> > <!-- start page -->
>>> >
>>> > <@s.textarea name="test2" theme="tdar"  label="test2"/>
>>> > <@s.textarea name="test" theme="xhtml" label="test" />
>>> >
>>> > <!-- end page -->
>>> >
>>> >
>>> >
>>> > Our theme lives in src/main/webapps/template.  We're not overriding the
>>> > templateDir directive anywhere.  Our theme "tdar"  contains the
>>> following
>>> > files:
>>> >
>>> >    - checkbox.ftl
>>> >    - checkboxlist.ftl
>>> >    - controlfooter.ftl
>>> >    - controlheader.ftl
>>> >    - controllabel.ftl
>>> >    - file.ftl
>>> >    - hidden.ftl
>>> >    - password.ftl
>>> >    - radiomap.ftl
>>> >    - select.ftl
>>> >    - text.ftl
>>> >    - textarea.ftl
>>> >    - theme.properties
>>> >
>>> >
>>> > When loading a page that uses only the textarea:
>>> >
>>> > <@s.textarea name="test" theme="tdar" />
>>> >
>>> >
>>> > we receive the following error:
>>> >
>>> > Caused by: freemarker.core._MiscTemplateException: Error reading
>>> included
>>> > file "template/~~~tdar/css.ftl":
>>> > Template "template/~~~tdar/css.ftl" not found.
>>> >
>>> > The failing instruction (print stack trace for 1 more):
>>> > ==> #include "/\${parameters.templateDir}...  [in template
>>> > "template/simple/textarea.ftl" at line 42, column 1]
>>> >
>>> >
>>> > the textarea.ftl contains:
>>> >
>>> > <#include
>>> > "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl"
>>> > /><#include "/${parameters.templateDir}/simple/textarea.ftl" />
>>> > <#include
>>> > "/${parameters.templateDir}/${parameters.theme}/controlfooter.ftl" />
>>> >
>>> >
>>> > note, I've tried change parameters.theme to parameters.expandTheme as
>>> > documented here:
>>> > http://struts.apache.org/release/2.3.x/docs/extending-themes.html
>>> >
>>> > our theme.properties contains:
>>> >
>>> > parent=simple
>>> >
>>> >
>>> > is anyone else seeing this? Or, are we missing something with our
>>> > configuration?
>>> >
>>> > thanks,
>>> >
>>> > adam
>>> > _________________________________________________________
>>> > Adam Brin
>>> > Director of Technology, Digital Antiquity
>>> > 480.965.1278
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>
>
> --
> _________________________________________________________
> Adam Brin
> Director of Technology, Digital Antiquity
> 480.965.1278

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message