I have a simple Stripes app running with freemarker templates.
How do I customize the freemarker BeansWrapper instance and the
ScopesHashModel instance?
With Struts 2, I can define a subclass of
org.apache.struts2.views.freemarker.FreemarkerManager that lets me do this:
public class CustomFreemarkerManager extends FreemarkerManager {
@Override
protected BeansWrapper getObjectWrapper() {
BeansWrapper beansWrapperInstance = super.getObjectWrapper();
beansWrapperInstance.setExposeFields(true);
return beansWrapperInstance;
}
@Override
protected ScopesHashModel buildScopesHashModel(ServletContext
servletContext, HttpServletRequest request, HttpServletResponse response,
ObjectWrapper wrapper, ValueStack stack) {
ScopesHashModel model =
super.buildScopesHashModel(servletContext,
request, response, wrapper, stack);
BeansWrapper beansWrapperInstance = getObjectWrapper();
model.put("statics", beansWrapperInstance.getStaticModels());
model.put("enums", beansWrapperInstance.getEnumModels());
return model;
}
}
I'm doing this so that:
- My templates can read bean properties without writing/maintaining a
getter method for every single property.
- My templates can access data/methods in static classes and enums.
Is there any way to do this in Stripes?
(I'm using most recent versions: Stripes 1.5rc1 + Freemarker 2.3.13 + JDK
1.6.07)
--
View this message in context:
http://www.nabble.com/Freemarker-Integration-with-Stripes--tp18986194p18986194.html
Sent from the stripes-users mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users