cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ovidiu Predescu <ovi...@cup.hp.com>
Subject Re: continuation fear (was Re: [status & RT] design challenges)
Date Thu, 11 Apr 2002 18:35:46 GMT
On Thu, 11 Apr 2002 20:19:16 +0200, Mats Norén <mats@alma.nu> wrote:

> Nice!!
> Another stupid question. How do I connect to other business objects and not
> just the sitemap?
> Can I call Java-functions for handling dbs and such from within the
> flowcontroller?

Sure you can, that's the whole point of the control flow layer, to
link the business logic (Java) with the presentation part (sitemap
pipelines).

In the flow layer, in JavaScript, you can refer to any Java class you
want. Just read the JavaScript documentation to see how to do it. You
can invoke a static method of a Java class to obtain an instance from
a pool, you can do JNDI lookups for registered objects, and so
on. Anything you want, really!

The control flow layer is the glue between your business logic and the
presentation part, and allows you to write the Web app in a nice,
procedural way.

Regards,
Ovidiu

> ----- Original Message -----
> From: "Ovidiu Predescu" <ovidiu@cup.hp.com>
> To: "Mats Norén" <mats@alma.nu>
> Cc: <cocoon-dev@xml.apache.org>
> Sent: Thursday, April 11, 2002 8:03 PM
> Subject: Re: continuation fear (was Re: [status & RT] design challenges)
> 
> 
> > On Thu, 11 Apr 2002 15:03:14 +0200, Mats Norén <mats@alma.nu> wrote:
> >
> > > Can I use recursion with the flow controller?
> > >
> > > For instance (incorrect syntax):
> > >
> > > function getSearchCriteria(a, b, c) {
> > >      var URI = "showthreedropdowns_uri"
> > >      Array result = {a, b, c}
> > >      if (c == "") {
> > >           sendPage(URI, a, b, c);
> > >           result = getSearchCriteria(from_response_a,
> > > from_response_b,from_response_c)
> > >      }
> > >      return result;
> > > }
> > >
> > > getSearchCriteria("*", "", "");
> > >
> > > The idea is that the parameters are used in a pipeline which display a
> form
> > > with the dropdowns A, B, C.
> > > The option values are gathered from a database query with the parameters
> a,
> > > b, c.
> > > B depends on A, C depends on B.
> > > The initial values means that only A will be populated.
> > > When a selection is made in A a javascript posts the values back, B will
> be
> > > populated and C will remain empty.
> > > When a seletion is made in B, C will be populated and the innermost
> > > getSearchCriteria will return and then the second and then the first,
> > > hopefully containing three values for the criteria.
> > > Is this possible?
> >
> > Yes, it is possible!
> >
> > There's one change you'd need to do in the sample above is to put the
> > last line inside a function:
> >
> > function showTree()
> > {
> >   getSearchCriteria("*", "", "");
> > }
> >
> > You would then add an entry in the sitemap to call this function:
> >
> >   <map:match pattern="...">
> >     <map:call function="showTree"/>
> >   </map:match>
> >
> > This provides the entry point in your application.
> >
> > Also to pass the business data to the URI, you'd need to put all of it
> > in a single object, so it can be accessed from the page. I think a
> > dictionary would be the best thing, as you can retrieve from it using
> > simple XPath expressions. So the above sendPage line would look like
> >
> >   sendPage(URI, {"a" : a, "b" : b, "c" : c});
> >
> > In your XSP you'd access the values of a, b or c using:
> >
> >   <jpath:value-of select="a"/>
> >
> > and so on.
> >
> > Hope this helps.
> >
> > Regards,
> > --
> > Ovidiu Predescu <ovidiu@cup.hp.com>
> > http://www.geocities.com/SiliconValley/Monitor/7464/ (GNU, Emacs, other
> stuff)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message