Thanks! That worked perfectly.

I know IDEs generate getters/setters, but:
 - that still takes several keystrokes
 - When I remove/rename property, the getters/setters typically need to be
manually updated.
 - It clutters up my source files with a high volume of unnecessary code.

Here's the code, for anyone who may find this thread via search:

public class CustomFreemarkerServlet extends FreemarkerServlet {
        @Override
        protected ObjectWrapper createObjectWrapper() {
                ObjectWrapper result = super.createObjectWrapper();
                if (result instanceof BeansWrapper) {
                        BeansWrapper beansWrapper = (BeansWrapper) result;
                        beansWrapper.setExposeFields(true);
                }
                return result;
        }
        
        @Override
        protected TemplateModel createModel(ObjectWrapper wrapper,
                                        ServletContext servletContext,
                                        HttpServletRequest request,
                                        HttpServletResponse response) throws
TemplateModelException {
                TemplateModel result = super.createModel(wrapper, 
servletContext, request,
response);
                if (result instanceof AllHttpScopesHashModel) {
                        AllHttpScopesHashModel hashModel = 
(AllHttpScopesHashModel) result;
                        if (wrapper instanceof BeansWrapper) {
                                BeansWrapper beansWrapper = (BeansWrapper) 
wrapper;
                                
                                hashModel.put("statics", 
beansWrapper.getStaticModels());
                                hashModel.put("enums", 
beansWrapper.getEnumModels());
                        }
                }

                return result;
        }
}
-- 
View this message in context: 
http://www.nabble.com/Freemarker-Integration-with-Stripes--tp18986194p18987042.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

Reply via email to