Thanks for the tip. I will have to have a closer look at the code you mentioned. At the moment I made a POJO bean and set it's field with the Content2BeanUtils in the PageMVCHandler subclass. These beans I can then easily pass around without running into "Session closed" exceptions.

It's definitely far from perfect... but it works too.

Regards,
will

P.S.: In general I'm not too happy about how JCR handles its data. For instance: When you fetch an object with a certain UUID you get two separate objects. Would be nice if the objects instantiated would be kept in a context until not used anymore. But that's a different topic and has nothing to do with Magnolia.

On 11.09.2008, at 15:34, Grégory Joseph wrote:

This is not a perfect a solution, but it exists, the forum module shows an example: * ForumController (extends PageMVCHandler) is called by posting to a form. This ** does the business, like replying to a thread etc (by delegating to ForumManager)
 ** knows how/where to redirect once done or in case of errors.
* Paragraphs are ActionBasedParagraph, which execute a little piece of code (see the info.magnolia.module.forum.frontend.action package) which will make stuff available to the templates (${action.foobar} would print what the action's getFoobar() method would return). This is currently only support with freemarker templates and a bit experimental (i.e subject to change), but it works.

hth,

-g

On Sep 11, 2008, at 10:42 AM, Will Scheidegger wrote:

Dear Magnolians

I'm hoping that someone can tell me "the right way" to access data that is used in several requests.

Description:
Magnolia features a "pages" mechanism (PageMVCHandler) which is an easy way for not having to place business logic in the templates. You can call a page, let it do the work and then display a standard magnolia page as result depending on the outcome of the work. Unfortunately this most likely includes two requests:
1. a request which calls the PageMVCHandler page
2. a redirect request to the standard magnolia page

Problem:
If you would like to do a query in the PageMVCHandler and then display the results in a standard magnolia page you will somehow need to display the fetched nodes in the second request. But the JCR session which fetched the nodes is closed after request one. When you access the nodes in request two, you will get a ton of Exceptions: javax.jcr.RepositoryException: this session has been closed.

What would be "the right way" to do this?

Thanks + regards,
will

----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------


----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------


----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------

Reply via email to