You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Matthew Payne (JIRA)" <ji...@apache.org> on 2009/08/13 01:25:59 UTC

[jira] Commented: (WW-3079) Allow for wiring global macro Freemarker library's within FreemarkerManager

    [ https://issues.apache.org/struts/browse/WW-3079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46626#action_46626 ] 

Matthew Payne commented on WW-3079:
-----------------------------------

You are missing out on a lot of flexibility and taking away freemarker functionality from default end users.
Yeah, one could wire in an alternate freemarker manager, but that still leaves the default one very much lacking.  

Why not fix they current one in a way that does not require spring?

> Allow for wiring global macro Freemarker library's within FreemarkerManager
> ---------------------------------------------------------------------------
>
>                 Key: WW-3079
>                 URL: https://issues.apache.org/struts/browse/WW-3079
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Integration
>    Affects Versions: Future
>            Reporter: Matthew Payne
>             Fix For: 2.1.8
>
>         Attachments: PMLFreeMarkerConfigurationFactoryBean.java
>
>
> Something similar can can be setup via for velocity Macro's .  We should be able to set certain macro libs as global without needing to import them directly in our freemarker templates. 
> Such a setting is currently not available in the current FreemarkerManager
> example of setting this up in another project(not struts based). 
> reference --> http://svn.riotfamily.org/svn/riotfamily/trunk/website/META-INF/riot/website-servlet.xml
> ---> notice macro lib property
> <bean id="freemarkerConfig" class="org.riotfamily.website.freemarker.WebsiteFreeMarkerConfigurer">
> 		<description>
> 			FreeMarker configuration.
> 		</description>
> 		<property name="defaultEncoding" value="UTF-8" />
> 		<property name="templateLoaderPaths">
> 		    <list>
> 		        <value>/WEB-INF/view</value>
> 		    </list>
> 		</property>
> 		<property name="freemarkerSettings" value="${website-servlet.freemarker.*}" />
> 		<property name="useTemplateCache" value="${website-servlet.useTemplateCache=true}" />
> 		<property name="macroLibraries">
> 			<props>
> 				<prop key="c">classpath:org/riotfamily/website/view/common.ftl</prop>
> 				<prop key="form">classpath:org/riotfamily/website/form/form.ftl</prop>
> 				<prop key="template">classpath:org/riotfamily/website/template/template.ftl</prop>
> 				<prop key="txt2img">classpath:org/riotfamily/website/txt2img/txt2img.ftl</prop>
> 			</props>
> 		</property>
> 		<property name="whitespaceStripping" value="true" />
> 	</bean>
> http://www.java2s.com/Open-Source/Java-Document/Content-Management-System/riotfamily/org/riotfamily/common/web/view/freemarker/RiotFreeMarkerConfigurer.java.htm
>   protected void importMacroLibraries(Configuration config) {
> 192:                if (macroLibraries != null) {
> 193:                    Enumeration names = macroLibraries.propertyNames();
> 194:                    while (names.hasMoreElements()) {
> 195:                        String namespace = (String) names.nextElement();
> 196:                        String lib = macroLibraries.getProperty(namespace);
> 197:                        log
> 198:                                .info(lib + " imported under namespace "
> 199:                                        + namespace);
> 200:                        config.addAutoImport(namespace, lib);
> 201:                    }
> 202:                }
> 203:            }
>      /**
> 074:             * Sets the macro libraries to be auto-imported, keyed by their namespace.
> 075:             */
> 076:            public void setMacroLibraries(Properties macroLibraries) {
> 077:                this .macroLibraries = macroLibraries;
> 078:            }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.