On 10/6/14 10:56 AM, Shrileckha Chaithanya wrote:
> thanks Woonsan.. Minoss also had the same idea?
>
> Btw can you pls explain the step by step I need to do.. Not sure how i
> can override the HstFreemarkerServlet. Are you telling me to create a
> class that extends HstFreemarkerServlet and use it in the web.xml?
Yes, you should add a class which extends HstFreemarkerServlet like the
following:
package org.example.servlet;
public class MyHstFreemarkerServlet extends HstFreemarkerServlet {
@Override
protected Configuration createConfiguration() {
Configuration config = super.createConfiguration();
// set shared variables here, for example:
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("www", "testing");
// ...
// NOTE: You might want to improve the loading vars better
// (e.g, loading from init param and prop file)
config.setAllSharedVariables(new SimpleHash(vars,
config.getObjectWrapper()));
return config;
}
}
And, change servlet classname in the web.xml like this:
<servlet-class>org.example.servlet.MyHstFreemarkerServlet</servlet-class>
Woonsan
> > <mailto:
j.r...@onehippo.com <mailto:
j.r...@onehippo.com>>> wrote:
> >
> > Hi,
> >
> > the code snippet is indeed for configuring the freemarker servlet
> > within Spring itself. Now by default Hippo has a FreemarkerServlet
> > defined within the web.xml of the project.
> >
> > Have you changed this to instantiate it from Spring or are you
> > trying to achieve something similar with Hippo as you would with Spring?
> >
> > Jeroen
> >
> > On Thu, Oct 2, 2014 at 11:42 PM, Shrileckha Chaithanya
> > <
cshri...@gmail.com <mailto:
cshri...@gmail.com>
> > <mailto:
hippo-c...@googlegroups.com
> <mailto:
hippo-community%2Bunsu...@googlegroups.com>
> > <mailto:
hippo-communi...@googlegroups.com
> <mailto:
hippo-community%2Bunsu...@googlegroups.com>>.
> > <mailto:
hippo-c...@googlegroups.com
> <mailto:
hippo-community%2Bunsu...@googlegroups.com>
> > <mailto:
hippo-communi...@googlegroups.com
> <mailto:
hippo-community%2Bunsu...@googlegroups.com>>.
> <mailto:
hippo-community%2Bunsu...@googlegroups.com>
> > <mailto:
hippo-communi...@googlegroups.com
> <mailto:
hippo-community%2Bunsu...@googlegroups.com>>.
>
w....@onehippo.com <mailto:
w....@onehippo.com>
www.onehippo.com
> <
http://www.onehippo.com>
> Boston - 101 Main Street, Cambridge, MA 02142
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> <mailto:
hippo-community%2Bunsu...@googlegroups.com>.