java - How to enable enums directive in Struts2 for FreeMarker results? -
say have enum class "sample.enums.enum", , have struts2 applications default configuration part.
if configure beanwrappers correctly, should work.
${enums["java.math.roundingmode"].up}
it not work. how configure struts2 freemarker configuration allow enums directive.
i.e.
root.put("enums", beanswrapper.getdefaultinstance().getenummodels());
ok not difficult, extend freemarkermanager , override
@override public simplehash buildtemplatemodel(valuestack stack, object action, servletcontext ervletcontext, httpservletrequest request, httpservletresponse response, objectwrapper wrapper)
in method, set enums hash model on model. set struts property,
<constant name="struts.freemarker.manager.classname" value="your.freemarker.configclass">
Comments
Post a Comment