cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luca Morandini" <luca.morandi...@tin.it>
Subject RE: dull problem : redirecting after transforming
Date Tue, 20 Aug 2002 15:55:26 GMT
Barbara,

I solved a problem like yours in a rather awkward way... but you may find it useful.

1) I wanted to choose a pipeline based on a parameter outputted by my database operations
(I use Stored Procedures, hence an output
parameter, called intStatus, was used as a status variable: 0 Ok, 1 Generic error, 2 Constraint
violation, ...

2) I wanted to pop-up a Javascript dialog box or an HTML page in the same window or an HTML
page in a new window in response to SP's
status

Hence, I built a pipeline like this:
<map:match name="wildcard" pattern="clearlog-execute.html">
	<map:aggregate element="page">
		<map:part src="documents/general/control-parameters.xml"/>
		<map:part src="cocoon:/sp-uman-clearlog.xml"/>
	</map:aggregate>
	<map:transform src="stylesheets/general/sp-control-html.xsl">
		<map:parameter name="control-section" value="clear-log"/>
	</map:transform>
    	<map:serialize type="html"/>
</map:match>

Where:

1) control-parameters.xml contained a list of actions to take in response to the SP's status,
like:
<spctl:control-section id="clear-log">
	<spctl:control trigger="{0}">
		<spctl:action href="changes.html"
			target="frameChanges"/>
		<spctl:window type="dialog"
	</spctl:control>
	<spctl:control trigger="{10}">
		<spctl:window type="dialog"
		message="Generic error, contact your database administrator"/>
	</spctl:control>
</spctl:control-section>

2) sp-uman-clearlog.xml is a pipelin that executes an SP

3) sp-control-html.xsl is a stylesheet which executes the action triggered by the SP's status
parameter (this actions have been
detailed in control-parameters.xml). This XSLT builds a minimal HTML page to be executed at
load time

4) By the way, I need an hidden frame to use it as a callback for the action

Let's see what happens in the control flow between client and server:

Case A) the SP returns "10" in intStatus:
1) Client --> clearlog-execute.html with hidden target (say "frameCmd")
2) Server --> HTML page containing the window.alert() to the frameCmd hidden frame executed
by onLoad event
3) The user see a Javascript dialog box

Case B) the SP returns "0" in intStatus:
1) Client --> clearlog-execute.html with hidden target (say "frameCmd")
2) Server --> HTML page with a form (executed by onLoad event) with points to "changes.html"
with target "frameChanges"
Client --> changes.html with shown target frameChanges
3) The user see the changes.html page in the frameChanges frame

Ugly and a bit slow, I know... but really flexible.

Best regards,

---------------------------------------------
               Luca Morandini
               GIS Consultant
              lmorandini@ieee.org
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------


> -----Original Message-----
> From: Barbara Post [mailto:babs33@ifrance.com]
> Sent: Tuesday, August 20, 2002 4:12 PM
> To: cocoon-users@xml.apache.org
> Subject: dull problem : redirecting after transforming
>
>
> I have a series of transformers (last one inserts in a database) then want
> to go to another pipeline (anyway I have to do a generation from new xml,
> not the DB successful insertion message) without having interaction with the
> user, how can I do that ?
>
> map:redirect-to uri="..." right after a map:transform causes Tomcat to throw
> a NPE.
>
> I cannot have a redirect-to after a xml serializer. I need to be able to
> pass a parameter to the next pipeline though...
>
> Thanks for any idea,
>
> Babs
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message