Hi,
I want to include a freemarker template using the <#include /> directive from another module. The template path is given to the including ftl (in module1) through a screen variable in the form "component://module2/path/to/ftl/name.ftl". The variable is named "myTemplate". Code .. <#include myTemplate> .. Freemarker cannot find the template because is searches for "component://module1/includes/component://module2/path/to/ftl/name.ftl". Is there a way to avoid that "component://module1/includes/" is used as the base? I tried .. <#include "/" + myTemplate> .. to give Freemarker a hint for an absolute path but it says Error rendering included template at location [component://module1/includes/header.ftl]: java.lang.IllegalArgumentException: Bad component location [component://component://module2/path/to/ftl/name.ftl]: base location missing slashes [/component://module2/path/to/ftl/name.ftl], first=0, second=-1; should be like: component://{component-name}/relative/path Any hints? Thanks and regards, Michael |
Hi everyone,
do you have any hint for me on this issue? Or is this simply not possible? Thanks and regards, Michael > Hi, > > I want to include a freemarker template using the <#include /> > directive from another module. > The template path is given to the including ftl (in module1) through a > screen variable in the form "component://module2/path/to/ftl/name.ftl". > The variable is named "myTemplate". > > Code > .. > <#include myTemplate> > .. > > Freemarker cannot find the template because is searches for > "component://module1/includes/component://module2/path/to/ftl/name.ftl". > Is there a way to avoid that "component://module1/includes/" is used as > the base? > > I tried > .. > <#include "/" + myTemplate> > .. > > to give Freemarker a hint for an absolute path but it says > > Error rendering included template at location > [component://module1/includes/header.ftl]: > java.lang.IllegalArgumentException: Bad component location > [component://component://module2/path/to/ftl/name.ftl]: base location > missing slashes [/component://module2/path/to/ftl/name.ftl], first=0, > second=-1; should be like: component://{component-name}/relative/path > > Any hints? > > Thanks and regards, > > Michael -- Regards, Michael |
hint: look at how "location=" is used in the screen definitions of
ofbiz "applications" to see how it is used to include .ftl from other modules. colin On 20 June 2012 20:04, Michael Brohl <[hidden email]> wrote: > Hi everyone, > > do you have any hint for me on this issue? > Or is this simply not possible? > > Thanks and regards, > > Michael > >> Hi, >> >> I want to include a freemarker template using the <#include /> >> directive from another module. >> The template path is given to the including ftl (in module1) through a >> screen variable in the form "component://module2/path/to/ftl/name.ftl". >> The variable is named "myTemplate". >> >> Code >> .. >> <#include myTemplate> >> .. >> >> Freemarker cannot find the template because is searches for >> "component://module1/includes/component://module2/path/to/ftl/name.ftl". >> Is there a way to avoid that "component://module1/includes/" is used as >> the base? >> >> I tried >> .. >> <#include "/" + myTemplate> >> .. >> >> to give Freemarker a hint for an absolute path but it says >> >> Error rendering included template at location >> [component://module1/includes/header.ftl]: >> java.lang.IllegalArgumentException: Bad component location >> [component://component://module2/path/to/ftl/name.ftl]: base location >> missing slashes [/component://module2/path/to/ftl/name.ftl], first=0, >> second=-1; should be like: component://{component-name}/relative/path >> >> Any hints? >> >> Thanks and regards, >> >> Michael > > > -- > > Regards, > > Michael > |
Try this <#include StringUtil.wrapString(myTemplate)>
Thanks& Regards Atul Vani Enterprise Software Developer HotWax Media Pvt. Ltd. http://www.hotwaxmedia.com/ We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for yourself. On 06/21/2012 01:28 AM, Colin Rooney wrote: > hint: look at how "location=" is used in the screen definitions of > ofbiz "applications" to see how it is used to include .ftl from other > modules. > > colin > > On 20 June 2012 20:04, Michael Brohl<[hidden email]> wrote: >> Hi everyone, >> >> do you have any hint for me on this issue? >> Or is this simply not possible? >> >> Thanks and regards, >> >> Michael >> >>> Hi, >>> >>> I want to include a freemarker template using the<#include /> >>> directive from another module. >>> The template path is given to the including ftl (in module1) through a >>> screen variable in the form "component://module2/path/to/ftl/name.ftl". >>> The variable is named "myTemplate". >>> >>> Code >>> .. >>> <#include myTemplate> >>> .. >>> >>> Freemarker cannot find the template because is searches for >>> "component://module1/includes/component://module2/path/to/ftl/name.ftl". >>> Is there a way to avoid that "component://module1/includes/" is used as >>> the base? >>> >>> I tried >>> .. >>> <#include "/" + myTemplate> >>> .. >>> >>> to give Freemarker a hint for an absolute path but it says >>> >>> Error rendering included template at location >>> [component://module1/includes/header.ftl]: >>> java.lang.IllegalArgumentException: Bad component location >>> [component://component://module2/path/to/ftl/name.ftl]: base location >>> missing slashes [/component://module2/path/to/ftl/name.ftl], first=0, >>> second=-1; should be like: component://{component-name}/relative/path >>> >>> Any hints? >>> >>> Thanks and regards, >>> >>> Michael >> >> -- >> >> Regards, >> >> Michael >> |
Free forum by Nabble | Edit this page |