On Thu, 11 Apr 2002 15:03:14 +0200, Mats Norén <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> http://www.geocities.com/SiliconValley/Monitor/7464/ (GNU, Emacs, other stuff) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]