struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoying, Ken" <Ken_Hoy...@PremierInc.com>
Subject RE: [Q] JavaTemplate Plugin
Date Wed, 17 Feb 2010 18:06:53 GMT
Issue registered:  https://issues.apache.org/jira/browse/WW-3386


-----Original Message-----
From: Lukasz Lenart [mailto:lukasz.lenart@googlemail.com] 
Sent: Wednesday, February 17, 2010 11:44 AM
To: Struts Users Mailing List
Subject: Re: [Q] JavaTemplate Plugin

2010/2/17 Hoying, Ken <Ken_Hoying@premierinc.com>:
> This ended up being a little tougher to accomplish than I had expected.
>
> I tried to override the TemplateEngineManager by specifying the bean in my struts.xml
file.  However, struts did not like that there was one already loaded from the struts-default.xml.
>
> So I created a copy of the struts-default.xml and placed it in my class path with a different
name.  In this new default xml I replaced the configuration for the TemplateEngineManager
with one that specified my class.  I then updated the filter configuration in my web.xml
to load my default xml file instead of the struts default xml.
>
>        <filter>
>                <filter-name>struts2</filter-name>
>                <filter-class>
>                        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
>                </filter-class>
>
>                <!-- Override so that we can replace struts-default.xml with
struts-sca-default.xml -->
>                <init-param>
>                <param-name>config </param-name>
>                <param-value>struts-sca-default.xml,struts-plugin.xml,struts.xml</param-value>
>        </init-param>
>        </filter>
>
> In my custom TemplateEngineManager, I extended the existing TemplateEngineManager and
overrode the getTemplateEngine() as such:
>
>    public TemplateEngine getTemplateEngine(Template template, String templateTypeOverride)
>    {
>        TemplateEngine engSelected = super.getTemplateEngine(template, templateTypeOverride);
>
>        if(engSelected instanceof JavaTemplateEngine)
>        {
>            if("simple".equalsIgnoreCase(template.getTheme()))
>            {
>                return engSelected;
>            } // end if
>            else
>            {
>                // JavaTemplateEngine currently only supports the "simple" theme,
so need to override
>                return super.getTemplateEngine(template, DEFAULT_TEMPLATE_TYPE);
>            } // end else
>        } // end if
>        else
>        {
>            return engSelected;
>        } // end else
>    } // end getTemplateEngine
>
>
> Thanks,
> Ken

Could you register this as a new issue?
https://issues.apache.org/jira/browse/


Pozdrawiam
-- 
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

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


-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer.  Thank you.  Premier Inc.
Mime
View raw message