on a related note.  After I switched to freemarker for my template 
definitions, I still wanted to use something struts actions for handling page 
behavior.  The PageMVCServlet works well for this.

With a patch (http://jira.magnolia.info/browse/MAGNOLIA-1351) you can use such 
a magnolia 'page' as a template.  Just replace the template path with 
something like: /.magnolia/pages/MyPage.html.  Now the MyPage page is used as 
the template.  Have a look at the TemplatedMVCHandler.

Or better still, just set up your template to use freemarker the way I 
outlined previously, and then define a sub template for the extension '.cmd' 
or '.do' or '.action' or whatever, and set this sub template up with a path 
to a page that uses a subclass of the PageMVCHandler.

In this way, /path/to/some/page.html is rendered with your freemarker 
template, and /path/to/some/page.cmd?command=someAction executes the public 
method someAction on your PageMVCHandler subclass.

Now freemarker is nicely used for templating, and your related PageMVCHandler 
is used for adding behavior to your page.  Mix in some ajax calls and you 
have a relatively flexible and well structured basis for extending Magnolia.

cheers,
Chris

Am Freitag, 9. Februar 2007 12:13 schrieb Chris Miner:
> Hi Stéphane,
>
> yes it is possible.  One has only to write the required wrapper classes.
> However there are no fixed rules for how that should be done.  The wrapper
> class interfaces are well defined, but the specifics of what the 'dot
> notation' in a freemarker template means is determined by these wrapper
> classes.
>
> An example if you write ${actpage.name}  in a freemarker template, should
> this return the property 'name' of the content node, or return the node
> name?  Or if we use ${actpage.nodeName} what should that return?  All of
> these are possible depending on how you write the wrappers.
>
> That said... I have written a  handfull classes (9 total) that I use with
> freemarker, which I could make available.  If you replace a .jsp file used
> in a template definition with an .ftl file and configure the
> FreemarkerServlet in your web.xml to use my ContentWrapper it 'just works'.
>  No additional changes needed.
>
> The only problem I had was that I didn't want to rewrite the cms edit bar
> tags.  But that isn't really a problem. You can use the existing jsp tags
> with freemarker templates when you have to.  There are only slight
> incompatibilities.
>
> Perhaps through use we could improve them and reach conclusions about how
> they should work?
>
> Cheers,
> Chris
>
> Am Freitag, 9. Februar 2007 10:19 schrieb Gauthier, Stephane (CH):
> > Hi Magnolians,
> >
> > Could somebody tell me whether it's possible to get dynamically
> > pageContext from a template page processed by freemarker and how to code
> > it? Many thanks in advance.
> >
> > Cheers
> >
> > Stéphane Gauthier
> >
> > *************************************************************************
> >** ********* This email and any files transmitted with it are confidential
> > and intended solely for the use of the individual or entity to whom they
> > are addressed. If you have received this email in error, please notify
> > the system manager ([EMAIL PROTECTED]) and delete the message with
> > any attached files from your system. The confidentiality and integrity of
> > this message cannot be guaranteed on the Internet and the sender does not
> > accept liability for its content.
> >
> > *************************************************************************
> >** ********
> >
> >
> > ----------------------------------------------------------------
> > for list details see
> > http://www.magnolia.info/en/magnolia/developer.html
> > ----------------------------------------------------------------
>
> ----------------------------------------------------------------
> for list details see
> http://www.magnolia.info/en/magnolia/developer.html
> ----------------------------------------------------------------

----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------

Reply via email to