cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <lgaw...@mobilebox.pl>
Subject Re: Getting the ServiceManager from Request?
Date Thu, 22 Jul 2004 19:00:49 GMT
Jochen Kuhnle wrote:
> I am working on a "ExtendedFormManager" which groups a form, several 
> bindings and data models together. The use case is to specify e.g. a form 
> which initializes from a "database model" with binding A and upon submit 
> stores itself into the "database model" with binding B and additionally 
> into a "mailto model" with binding C, thus storing and sending an email. 
> The "ExtendedFormManager" should manage the whole thing together as 
> painlessly as possible, it should be a Service, and should be created from 
> a configuration file automatically when a form is needed.
> 
> One Situation is in the form template, where you get the form through a 
> JXPath expression. Something like the following would be nice there:
> 
> <ft:form-template location="ExtendedFormManagerHelper.getForm($request, 
> 'MyExtendedForm')"> 
> 
> where ExtendedFormManagerHelper.getForm is a static method that does the 
> Service lookup and initialization.
> 
> For this to work, I need to get the ServiceManager in order to get to my 
> ExtendedFormManager Service. According to the code 
> (FormsPipelineConfig.createConfig), the JXPath context only has variables 
> for continuation, request, session and parameters.
so obtain this extended form manager in flow :

form.setBookmark();
var mgr = cocoon.getComponent( ExtendedFormManager.ROLE );
form.showForm( "myview", { mgr: mgr } );

There is somethink like form bookmark which stores the continuation to 
restart the form. So every time your form gets show a new manager is 
being looked up. You should release this manager after every form 
roundtrip (really do not know how to do it here - you might have to 
change Form.js).

then do it like this:
<ft:form-template location="mgr.getForm($request, 'MyExtendedForm')">

HTH

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65


Mime
View raw message