Wooopsie!
Sorry, forget about "site", the correct line should say
if (contextManager.existsContext("mycontext"))
My cocoon aplication uses a kind of home-made virtual system and
handles serveral different websites, so I keep a different context for
each one of them. I cleaned the functions before sending them to you,
but I forgot to clean that line. :)
Sorry
2005/5/2, Sebastien Arbogast <[EMAIL PROTECTED]>:
> > If you want to use the session framework, it's much more complicated..
> > Here's an example on two wrappper functions to get and set a string in
> > a path inside the session framework. Pay attention on two things: a
> > session can have many diferent contexts (for different kind of data,
> > etc.), and to locate data, you use xpath. If a context is not defined
> > and you try to access to it, it'll throw an exception, so be careful.
> >
> > function setData(path,value) {
> > var
> > contextManager=cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE);
> > var myContext;
> > if (contextManager.existsContext(site))
> > myContext=contextManager.getContext("mycontext");
> > else myContext=contextManager.createContext("mycontext","","");
> > myContext.setAttribute(path,value);
> > cocoon.releaseComponent(contextManager);
> > }
>
> I'm trying to use Nacho's two wrapper functions but there is just one
> thing I don't understand : what does the "site" parameter stand for in
> call to contextManager.existsContext(site) ? Where does its value come
> from ?
>
> Thx in advance...
>
> --
> Sebastien ARBOGAST
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]