On Mon, 15 Apr 2002 14:11:15 +0200, Mats Nor�n <[EMAIL PROTECTED]> wrote:
> Ovidiu,
> I have some stupid user questions again ;)
No question is stupid, so go ahead ;-)
> I�ve been snooping around in your code and I�m wondering which way
> do you feel is the simplest way of integrating Java components into
> schecoon?
>
> Would it be possible in an easy way to reuse some of the actions
> already present in C2. For instance the old database actions or
> maybe the new ones?
I think actions should work fine if you put them right before
<map:call function="..."/> in a pipeline. Actions don't generate any
SAX events on the pipeline, so they should not interfere with the
later invocation of the sitemap via sendPage() or
sendPageAndContinue() functions.
> And for my last question, can I send parameters from the sitemap to the
> function I�m invoking:
>
> <map:call function="function({1})"/>
>
> or maybe
>
> <map:call function="function()">
> <map:param name="a" value="{1}"/>
> </map:call>
Yes, the second approach is how it works, although you don't need to
use parenthesis, and you need to use <map:parameter> instead of
<map:param>. Like this:
<map:match pattern="a pattern">
<map:call function="function">
<map:parameter name="a" value="{1}"/>
</map:call>
</map:match>
> In the full continuation method I don�t see the need to send any parameters
> but in the method you described below I need a way to pass on information
> encoded in the uri and not from the request parameters.
> For example:
>
> sitemap.xmap:
>
> <map:resource>
> <map:script src="detail.js"/>
> </map:resource>
>
> <!-- a detail contains detailed information about the object with id
> {2} -->
> <!-- {1} action to perform, {2} id of detail. -->
> <map:match pattern="detail/*/*.html">
> <map:call function="{1}">
> <map:parameter name="id" value="{2}"/>
> </map:call>
> </map:match>
>
> detail.js:
>
> function show(id)
> {
> // the page at uri uses the ESQL taglib to retrieve information about
> an object from DB
> sendPageAndContinue("show_detail_with_id", {"edit": "edit", "new" :
> "new"});
> }
>
> function edit(id)
> {
> // show edit view
> sendPageAndContinue("show_edit_view_for_id", {"update": "update", "delete"
> : "delete"});
> }
>
> function update(id)
> {
> getParametersFromRequest();
> writeInformationToDB
> show(id);
> }
>
> function new()
> {
> id = incrementCounterInDB();
> createEmptyRecordInDB(id);
> edit(id);
> }
>
> function delete(id)
> {
> deleteFromDBDetailWithId(id);
> showPageAndContinue("show_list_of_objects_uri")
> }
This example should work fine.
Just be careful that the name in <map:param> is not really
used. Parameters are just passed to the invoked function based on
their position.
You can also pass parameters to continuations. Just use:
<map:continue with="{1}">
<map:parameter name="a" value="..."/>
</map:continue>
The parameters can be obtained in JavaScript by accessing
cocoon.parameters["a"], after sendPage() returns:
function someFunction()
{
// do some work here
...
sendPage(uri, bizData);
// Obtain the parameter passed from the sitemap
var a = cocoon.parameters["a"];
...
}
The parameters to the function can be accessed in the same way. Just
remember that the value of cocoon.parameters changes each time after a
sendPage().
I'd be curious to know to which extend you're using Schecoon so far,
and how do you find it.
Best 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]