You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ARakesh <ra...@yahoo.com> on 2007/11/02 23:32:02 UTC

Extending the FreemarkerManager

I am extending to FreemarkerManager to customize the tempalte:

    @Override
    protected Configuration createConfiguration(ServletContext
servletContext) throws TemplateException {
        Configuration config = super.createConfiguration(servletContext);
        ClassTemplateLoader ctl = new ClassTemplateLoader(getClass(), "");
        TemplateLoader[] loaders = new TemplateLoader[] { ctl };
        MultiTemplateLoader mtl = new MultiTemplateLoader(loaders);
        config.setTemplateLoader(mtl);
        System.out.println("PlutoFreeMarkerManager.createConfiguration()");
        return config;
    }

So, i override this protected method right. And then in the struts.xml I set
the following property

    <constant name="struts.freemarker.manager.classname"
value="com.plateau.demo.pluto.servlet.PlutoFreeMarkerManager"></constant>

But, when I try to access the my application it says it could not find the
FTL files.

Keeping that aside, I tried keeping some basic log messages by overriding
the method but no use, the basic issue I am having is how else can I make
struts to use my Custom Freemarker class.

Any ideas, please?

Rakesh
-- 
View this message in context: http://www.nabble.com/Extending-the-FreemarkerManager-tf4741063.html#a13557438
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Extending the FreemarkerManager

Posted by MassimoH <Ma...@gmail.com>.
I'm doing this in struts.properties:

struts.freemarker.manager.classname=org.me.MyFreemarkerManager

And Struts 2.0.x is definitely using my custom class. Could you try
configuring that in struts.properties file rather than in struts.xml?


ARakesh wrote:
> 
> I am extending the FreemarkerManager to customize the template loading:
> 
>     @Override
>     protected Configuration createConfiguration(ServletContext
> servletContext) throws TemplateException {
>         Configuration config = super.createConfiguration(servletContext);
>         ClassTemplateLoader ctl = new ClassTemplateLoader(getClass(), "");
>         TemplateLoader[] loaders = new TemplateLoader[] { ctl };
>         MultiTemplateLoader mtl = new MultiTemplateLoader(loaders);
>         config.setTemplateLoader(mtl);
>        
> System.out.println("CustomFreeMarkerManager.createConfiguration()");
>         return config;
>     }
> 
> So, i override this protected method right. And then in the struts.xml I
> set the following property
> 
>     <constant name="struts.freemarker.manager.classname"
> value="com.demo.CustomFreeMarkerManager"></constant>
> 
> But, when I try to access the my application it says it could not find the
> FTL files.
> 
> Keeping that aside, I tried keeping some basic log messages by overriding
> the method but no use, the basic issue I am having is how else can I make
> struts to use my Custom Freemarker class.
> 
> Any ideas, please?
> 
> Rakesh
> 

-- 
View this message in context: http://www.nabble.com/Extending-the-FreemarkerManager-tf4741063.html#a13595062
Sent from the Struts - User mailing list archive at Nabble.com.


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