I am using CMS to store Freemarker templates. These freemarker templates are
called inside the Screen Widgets using Content element. My freemarker templates also include other screens as well as HTML tags such as <div>. Screens inside the freemarker template are rendered using render.screen(“ScreenName”) method. Now the problem is, when Freemarker template is rendered it renders the screen properly but the HTML tags part of the freemarker templates are rendered after the render.screen() call irrespective of the location of the html tags in the FTL template. Only difference between what I am doing and out of the box code is that FTL templates are stored in the CMS instead of the file system and called inside the screen widget using the Content (or SubContent) element instead of “platform-specific element”. I am not sure what is the difference in freemarker rendering when template is stored in the CMS. Can someone point me to the right code to look into this problem. Thanks & Regards Ganesh Bawne |
Hi Ganesh,
I fixed this in the trunk earlier in the year but I guess I didn't back port it to 9.04 (or you're using an old trunk revision). If you look at the commit history for MacroScreenRenderer.java from sometime around February or March you should be able to find the changes easily enough. From memory I think the problem was that the screen renderer was using the writer passed to it during initialization instead of the one passed to it in each of the render* methods. Regards Scott HotWax Media http://www.hotwaxmedia.com On 6/08/2010, at 10:26 PM, Ganesh Bawne wrote: > I am using CMS to store Freemarker templates. These freemarker templates are > called inside the Screen Widgets using Content element. My freemarker > templates also include other screens as well as HTML tags such as <div>. > Screens inside the freemarker template are rendered using > render.screen(“ScreenName”) method. > > Now the problem is, when Freemarker template is rendered it renders the > screen properly but the HTML tags part of the freemarker templates are > rendered after the render.screen() call irrespective of the location of the > html tags in the FTL template. > > Only difference between what I am doing and out of the box code is that FTL > templates are stored in the CMS instead of the file system and called inside > the screen widget using the Content (or SubContent) element instead of > “platform-specific element”. I am not sure what is the difference in > freemarker rendering when template is stored in the CMS. > > Can someone point me to the right code to look into this problem. > > > > > Thanks & Regards > Ganesh Bawne smime.p7s (3K) Download Attachment |
Thank you Scott,
I am using branch 10.04. URL: http://svn.apache.org/repos/asf/ofbiz/branches/release10.04 Revision: 966169 Last Changed Rev: 965809 Last Changed Date: 2010-07-20 16:52:34 +0530 (Tue, 20 Jul 2010) Thanks, Ganesh On Fri, Aug 6, 2010 at 4:28 PM, Scott Gray <[hidden email]>wrote: > Hi Ganesh, > > I fixed this in the trunk earlier in the year but I guess I didn't back > port it to 9.04 (or you're using an old trunk revision). > > If you look at the commit history for MacroScreenRenderer.java from > sometime around February or March you should be able to find the changes > easily enough. From memory I think the problem was that the screen renderer > was using the writer passed to it during initialization instead of the one > passed to it in each of the render* methods. > > Regards > Scott > > HotWax Media > http://www.hotwaxmedia.com > > On 6/08/2010, at 10:26 PM, Ganesh Bawne wrote: > > > I am using CMS to store Freemarker templates. These freemarker templates > are > > called inside the Screen Widgets using Content element. My freemarker > > templates also include other screens as well as HTML tags such as <div>. > > Screens inside the freemarker template are rendered using > > render.screen(“ScreenName”) method. > > > > Now the problem is, when Freemarker template is rendered it renders the > > screen properly but the HTML tags part of the freemarker templates are > > rendered after the render.screen() call irrespective of the location of > the > > html tags in the FTL template. > > > > Only difference between what I am doing and out of the box code is that > FTL > > templates are stored in the CMS instead of the file system and called > inside > > the screen widget using the Content (or SubContent) element instead of > > “platform-specific element”. I am not sure what is the difference in > > freemarker rendering when template is stored in the CMS. > > > > Can someone point me to the right code to look into this problem. > > > > > > > > > > Thanks & Regards > > Ganesh Bawne > > -- Thanks & Regards Ganesh Bawne Enterprise Software Developer Viithiisys Pvt. Ltd. http://www.viithiisys.com |
Hi Scott,
I verified the MacroScreenRenderer.java for branch 10.04 and the fixes are applied as you elaborated to Revision:932171. But I am still facing the problem in branch as well as in trunk. Thanks, Ganesh On Fri, Aug 6, 2010 at 4:37 PM, Ganesh Bawne <[hidden email]> wrote: > Thank you Scott, > > I am using branch 10.04. > > URL: http://svn.apache.org/repos/asf/ofbiz/branches/release10.04 > Revision: 966169 > Last Changed Rev: 965809 > Last Changed Date: 2010-07-20 16:52:34 +0530 (Tue, 20 Jul 2010) > > > Thanks, > Ganesh > > > > On Fri, Aug 6, 2010 at 4:28 PM, Scott Gray <[hidden email]>wrote: > >> Hi Ganesh, >> >> I fixed this in the trunk earlier in the year but I guess I didn't back >> port it to 9.04 (or you're using an old trunk revision). >> >> If you look at the commit history for MacroScreenRenderer.java from >> sometime around February or March you should be able to find the changes >> easily enough. From memory I think the problem was that the screen renderer >> was using the writer passed to it during initialization instead of the one >> passed to it in each of the render* methods. >> >> Regards >> Scott >> >> HotWax Media >> http://www.hotwaxmedia.com >> >> On 6/08/2010, at 10:26 PM, Ganesh Bawne wrote: >> >> > I am using CMS to store Freemarker templates. These freemarker templates >> are >> > called inside the Screen Widgets using Content element. My freemarker >> > templates also include other screens as well as HTML tags such as <div>. >> > Screens inside the freemarker template are rendered using >> > render.screen(“ScreenName”) method. >> > >> > Now the problem is, when Freemarker template is rendered it renders the >> > screen properly but the HTML tags part of the freemarker templates are >> > rendered after the render.screen() call irrespective of the location of >> the >> > html tags in the FTL template. >> > >> > Only difference between what I am doing and out of the box code is that >> FTL >> > templates are stored in the CMS instead of the file system and called >> inside >> > the screen widget using the Content (or SubContent) element instead of >> > “platform-specific element”. I am not sure what is the difference in >> > freemarker rendering when template is stored in the CMS. >> > >> > Can someone point me to the right code to look into this problem. >> > >> > >> > >> > >> > Thanks & Regards >> > Ganesh Bawne >> >> > > > -- > Thanks & Regards > Ganesh Bawne > Enterprise Software Developer > Viithiisys Pvt. Ltd. > http://www.viithiisys.com > -- Thanks & Regards Ganesh Bawne Enterprise Software Developer Viithiisys Pvt. Ltd. http://www.viithiisys.com |
Hmm that's strange. It does sound like a very similar problem though. screens.render(...) is probably using the response's writer whereas the content rendering is using it's own that later gets pushed to the response. One option is to write a freemarker TemplateDirective to use in place of the screens.render(...) call, that way you'll be able to get ahold of a writer from freemarker to use to render the screen. I had started to do this a while back, if you wanted to wait a day or so I could dig up what I had done and send it over.
Another option is to replace the ScreenRenderer instance stored in ${screens} with the one that uses the same writer as is given to FreeMarkerWorker from within the content rendering stuff. Regards Scott On 6/08/2010, at 11:46 PM, Ganesh Bawne wrote: > Hi Scott, > > I verified the MacroScreenRenderer.java for branch 10.04 and the fixes are > applied as you elaborated to Revision:932171. > But I am still facing the problem in branch as well as in trunk. > > Thanks, > Ganesh > > > > On Fri, Aug 6, 2010 at 4:37 PM, Ganesh Bawne <[hidden email]> wrote: > >> Thank you Scott, >> >> I am using branch 10.04. >> >> URL: http://svn.apache.org/repos/asf/ofbiz/branches/release10.04 >> Revision: 966169 >> Last Changed Rev: 965809 >> Last Changed Date: 2010-07-20 16:52:34 +0530 (Tue, 20 Jul 2010) >> >> >> Thanks, >> Ganesh >> >> >> >> On Fri, Aug 6, 2010 at 4:28 PM, Scott Gray <[hidden email]>wrote: >> >>> Hi Ganesh, >>> >>> I fixed this in the trunk earlier in the year but I guess I didn't back >>> port it to 9.04 (or you're using an old trunk revision). >>> >>> If you look at the commit history for MacroScreenRenderer.java from >>> sometime around February or March you should be able to find the changes >>> easily enough. From memory I think the problem was that the screen renderer >>> was using the writer passed to it during initialization instead of the one >>> passed to it in each of the render* methods. >>> >>> Regards >>> Scott >>> >>> HotWax Media >>> http://www.hotwaxmedia.com >>> >>> On 6/08/2010, at 10:26 PM, Ganesh Bawne wrote: >>> >>>> I am using CMS to store Freemarker templates. These freemarker templates >>> are >>>> called inside the Screen Widgets using Content element. My freemarker >>>> templates also include other screens as well as HTML tags such as <div>. >>>> Screens inside the freemarker template are rendered using >>>> render.screen(“ScreenName”) method. >>>> >>>> Now the problem is, when Freemarker template is rendered it renders the >>>> screen properly but the HTML tags part of the freemarker templates are >>>> rendered after the render.screen() call irrespective of the location of >>> the >>>> html tags in the FTL template. >>>> >>>> Only difference between what I am doing and out of the box code is that >>> FTL >>>> templates are stored in the CMS instead of the file system and called >>> inside >>>> the screen widget using the Content (or SubContent) element instead of >>>> “platform-specific element”. I am not sure what is the difference in >>>> freemarker rendering when template is stored in the CMS. >>>> >>>> Can someone point me to the right code to look into this problem. >>>> >>>> >>>> >>>> >>>> Thanks & Regards >>>> Ganesh Bawne >>> >>> >> >> >> -- >> Thanks & Regards >> Ganesh Bawne >> Enterprise Software Developer >> Viithiisys Pvt. Ltd. >> http://www.viithiisys.com >> > > > > -- > Thanks & Regards > Ganesh Bawne > Enterprise Software Developer > Viithiisys Pvt. Ltd. > http://www.viithiisys.com smime.p7s (3K) Download Attachment |
Thank you Scott,
Very much appreciated your quick response with proper explanation. I can wait till you finish up your code, meantime I am also exploring the code in more details :) Thanks again, Ganesh On Fri, Aug 6, 2010 at 5:29 PM, Scott Gray <[hidden email]>wrote: > Hmm that's strange. It does sound like a very similar problem though. > screens.render(...) is probably using the response's writer whereas the > content rendering is using it's own that later gets pushed to the response. > One option is to write a freemarker TemplateDirective to use in place of > the screens.render(...) call, that way you'll be able to get ahold of a > writer from freemarker to use to render the screen. I had started to do > this a while back, if you wanted to wait a day or so I could dig up what I > had done and send it over. > > Another option is to replace the ScreenRenderer instance stored in > ${screens} with the one that uses the same writer as is given to > FreeMarkerWorker from within the content rendering stuff. > > Regards > Scott > > On 6/08/2010, at 11:46 PM, Ganesh Bawne wrote: > > > Hi Scott, > > > > I verified the MacroScreenRenderer.java for branch 10.04 and the fixes > are > > applied as you elaborated to Revision:932171. > > But I am still facing the problem in branch as well as in trunk. > > > > Thanks, > > Ganesh > > > > > > > > On Fri, Aug 6, 2010 at 4:37 PM, Ganesh Bawne <[hidden email]> > wrote: > > > >> Thank you Scott, > >> > >> I am using branch 10.04. > >> > >> URL: http://svn.apache.org/repos/asf/ofbiz/branches/release10.04 > >> Revision: 966169 > >> Last Changed Rev: 965809 > >> Last Changed Date: 2010-07-20 16:52:34 +0530 (Tue, 20 Jul 2010) > >> > >> > >> Thanks, > >> Ganesh > >> > >> > >> > >> On Fri, Aug 6, 2010 at 4:28 PM, Scott Gray <[hidden email] > >wrote: > >> > >>> Hi Ganesh, > >>> > >>> I fixed this in the trunk earlier in the year but I guess I didn't back > >>> port it to 9.04 (or you're using an old trunk revision). > >>> > >>> If you look at the commit history for MacroScreenRenderer.java from > >>> sometime around February or March you should be able to find the > changes > >>> easily enough. From memory I think the problem was that the screen > renderer > >>> was using the writer passed to it during initialization instead of the > one > >>> passed to it in each of the render* methods. > >>> > >>> Regards > >>> Scott > >>> > >>> HotWax Media > >>> http://www.hotwaxmedia.com > >>> > >>> On 6/08/2010, at 10:26 PM, Ganesh Bawne wrote: > >>> > >>>> I am using CMS to store Freemarker templates. These freemarker > templates > >>> are > >>>> called inside the Screen Widgets using Content element. My freemarker > >>>> templates also include other screens as well as HTML tags such as > <div>. > >>>> Screens inside the freemarker template are rendered using > >>>> render.screen(“ScreenName”) method. > >>>> > >>>> Now the problem is, when Freemarker template is rendered it renders > the > >>>> screen properly but the HTML tags part of the freemarker templates are > >>>> rendered after the render.screen() call irrespective of the location > of > >>> the > >>>> html tags in the FTL template. > >>>> > >>>> Only difference between what I am doing and out of the box code is > that > >>> FTL > >>>> templates are stored in the CMS instead of the file system and called > >>> inside > >>>> the screen widget using the Content (or SubContent) element instead of > >>>> “platform-specific element”. I am not sure what is the difference in > >>>> freemarker rendering when template is stored in the CMS. > >>>> > >>>> Can someone point me to the right code to look into this problem. > >>>> > >>>> > >>>> > >>>> > >>>> Thanks & Regards > >>>> Ganesh Bawne > >>> > >>> > >> > >> > >> -- > >> Thanks & Regards > >> Ganesh Bawne > >> Enterprise Software Developer > >> Viithiisys Pvt. Ltd. > >> http://www.viithiisys.com > >> > > > > > > > > -- > > Thanks & Regards > > Ganesh Bawne > > Enterprise Software Developer > > Viithiisys Pvt. Ltd. > > http://www.viithiisys.com > > -- Thanks & Regards Ganesh Bawne Enterprise Software Developer Viithiisys Pvt. Ltd. http://www.viithiisys.com |
In reply to this post by Scott Gray-2
hello Scot,
Have you got the solution here? I have the same problem. Thanks a lot in advance Robert |
Free forum by Nabble | Edit this page |