You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Yves Vindevogel <yv...@implements.be> on 2003/03/17 22:44:43 UTC

Passing parameters from xsp to xsp

Hi,

I need to pass request parameters from one XSP to another

This is my sitemap
                        <map:match pattern="db/*/*.xsp">
                        	<map:generate src="db/{1}/{2}.xsp" type="xsp"/>
                                <map:transform src="xsl/db.generatexsp.xsl"/>
                                <map:serialize type="xml"/>
                        </map:match>
                        <map:match pattern="db/*/*.html">
                                <map:generate 
src="http://web/implements/db/{1}/{2}.xsp"/>

                                <map:serialize type="xml"/>
                        </map:match>

As you can see, I call the XSP from my call to the HTML.
I need one XSP as a generator, because it must execute an ESQL query.
But, the XSP called in that match (html match) calls another XSP that uses the 
request parameters. 

However, they are not passed in that call.  I cannot use <map:parameter 
name="use-request-parameters"> since this is for a transformer.

I need the same kind of thing, but for a generator.

Anyone with an idea ??

Some code:

This is my XSP that is called:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java"
                        xmlns:xsp="http://apache.org/xsp"
                        xmlns:xsp-request="http://apache.org/xsp/request/2.0"
                        xmlns:xsp-session="http://apache.org/xsp/session/2.0"
                        create-session="true">

        <xml>
                <query>
                        select fnSiteRegisteredUserInsert 
('<xsp-request:get-parameter name="email"/>',
                                                '<xsp-request:get-parameter 
name="password"/>')
                </query>
                <results>
                        <result>
                                <value>0</value>
                                <message>You have been registered</message>
                        </result>
                </results>
                <errors>
                        <error>
                                <value>ERROR: Cannot insert a duplicate key 
into unique index tblsiteregistereduser_login_key</value>
                                <message>You already exist</message>
                        </error>
                </errors>
        </xml>
</xsp:page>

As you can see, that needs the parameters.


This is the XSL for transformation to a valid XSP

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:fo="http://www.w3.org/1999/XSL/Format"
    			xmlns:xsp="http://apache.org/xsp"
			xmlns:esql="http://apache.org/cocoon/SQL/v2"
			xmlns:xsp-request="http://apache.org/xsp/request/2.0"
			xmlns:xsp-session="http://apache.org/xsp/session/2.0"

>

        <xsl:template match="/xml">
                <xsp:page language="java" create-session="true">

                        <xml>

                        <esql:connection>
                                <esql:pool>implements</esql:pool>

                                <esql:execute-query>
                                        <esql:query>
                                        	<xsl:value-of select="query"/>
                                        </esql:query>

                                        <esql:results>
                                                <esql:row-results>
                                                	<result>
                                                                
<esql:get-columns/>
                                                 	</result>
                                                </esql:row-results>
                                        </esql:results>

                                        <esql:error-results>
                                                
<error><esql:get-message/></error>
                                        </esql:error-results>
                                </esql:execute-query>
                        </esql:connection>

                        </xml>
                </xsp:page>
	</xsl:template>
</xsl:stylesheet>

-- 
Met vriendelijke groeten,
Kind regards,
Bien à vous,

Yves Vindevogel

Implements
Kempische Steenweg 206  --  3500 Hasselt  --  Belgium
Phone/Fax: +32 (11) 43.55.76  --  Mobile: +32 (478) 80.82.91
Mail: yves.vindevogel@implements.be  --  www.implements.be

Quote: The winner never says participating is more important than winning.

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


Re: Passing parameters from xsp to xsp

Posted by Yves Vindevogel <yv...@implements.be>.
No, that's the same ...
When the .html is called, the XSP can use the <xsp-request:get-parameter>
However, it calls a new match, where the values of the request are no longer 
available

That's exactly my problem.

> I don't know if it's possible but why don't you try this :
>
> <map:match pattern="db/*/*.xsp">
>                 <map:generate src="db/{1}/{2}.xsp" type="xsp"/>
>           <map:transform src="xsl/db.generatexsp.xsl"/>
>           <map:serialize type="xml"/>
> </map:match>
> <map:match pattern="db/*/*.html">
>             <map:generate src="cocoon:/db/{1}/{2}.xsp"/>
>            <map:serialize type="xml"/>
> </map:match>
>
>
> Lionel
>
> At 22:44 17/03/2003 +0100, you wrote:
> >Hi,
> >
> >I need to pass request parameters from one XSP to another
> >
> >This is my sitemap
> >                         <map:match pattern="db/*/*.xsp">
> >                                 <map:generate src="db/{1}/{2}.xsp"
> > type="xsp"/>
> >                                 <map:transform
> > src="xsl/db.generatexsp.xsl"/> <map:serialize type="xml"/>
> >                         </map:match>
> >                         <map:match pattern="db/*/*.html">
> >                                 <map:generate
> >src="http://web/implements/db/{1}/{2}.xsp"/>
> >
> >                                 <map:serialize type="xml"/>
> >                         </map:match>
> >
> >As you can see, I call the XSP from my call to the HTML.
> >I need one XSP as a generator, because it must execute an ESQL query.
> >But, the XSP called in that match (html match) calls another XSP that uses
> >the
> >request parameters.
> >
> >However, they are not passed in that call.  I cannot use <map:parameter
> >name="use-request-parameters"> since this is for a transformer.
> >
> >I need the same kind of thing, but for a generator.
> >
> >Anyone with an idea ??
> >
> >Some code:
> >
> >This is my XSP that is called:
> ><?xml version="1.0" encoding="ISO-8859-1"?>
> ><xsp:page language="java"
> >                         xmlns:xsp="http://apache.org/xsp"
> >                        
> > xmlns:xsp-request="http://apache.org/xsp/request/2.0"
> > xmlns:xsp-session="http://apache.org/xsp/session/2.0"
> > create-session="true">
> >
> >         <xml>
> >                 <query>
> >                         select fnSiteRegisteredUserInsert
> >('<xsp-request:get-parameter name="email"/>',
> >                                                
> > '<xsp-request:get-parameter name="password"/>')
> >                 </query>
> >                 <results>
> >                         <result>
> >                                 <value>0</value>
> >                                 <message>You have been
> > registered</message> </result>
> >                 </results>
> >                 <errors>
> >                         <error>
> >                                 <value>ERROR: Cannot insert a duplicate
> > key into unique index tblsiteregistereduser_login_key</value>
> >                                 <message>You already exist</message>
> >                         </error>
> >                 </errors>
> >         </xml>
> ></xsp:page>
> >
> >As you can see, that needs the parameters.
> >
> >
> >This is the XSL for transformation to a valid XSP
> >
> ><?xml version="1.0" encoding="UTF-8"?>
> ><xsl:stylesheet version="1.0"
> >         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >         xmlns:fo="http://www.w3.org/1999/XSL/Format"
> >                         xmlns:xsp="http://apache.org/xsp"
> >                         xmlns:esql="http://apache.org/cocoon/SQL/v2"
> >                        
> > xmlns:xsp-request="http://apache.org/xsp/request/2.0"
> > xmlns:xsp-session="http://apache.org/xsp/session/2.0"
> >
> >
> >
> >         <xsl:template match="/xml">
> >                 <xsp:page language="java" create-session="true">
> >
> >                         <xml>
> >
> >                         <esql:connection>
> >                                 <esql:pool>implements</esql:pool>
> >
> >                                 <esql:execute-query>
> >                                         <esql:query>
> >                                                 <xsl:value-of
> > select="query"/>
> >                                         </esql:query>
> >
> >                                         <esql:results>
> >                                                 <esql:row-results>
> >                                                         <result>
> >
> ><esql:get-columns/>
> >                                                         </result>
> >                                                 </esql:row-results>
> >                                         </esql:results>
> >
> >                                         <esql:error-results>
> >
> ><error><esql:get-message/></error>
> >                                         </esql:error-results>
> >                                 </esql:execute-query>
> >                         </esql:connection>
> >
> >                         </xml>
> >                 </xsp:page>
> >         </xsl:template>
> ></xsl:stylesheet>
> >
> >--
> >Met vriendelijke groeten,
> >Kind regards,
> >Bien à vous,
> >
> >Yves Vindevogel
> >
> >Implements
> >Kempische Steenweg 206  --  3500 Hasselt  --  Belgium
> >Phone/Fax: +32 (11) 43.55.76  --  Mobile: +32 (478) 80.82.91
> >Mail: yves.vindevogel@implements.be  --  www.implements.be
> >
> >Quote: The winner never says participating is more important than winning.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> >For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

-- 
Met vriendelijke groeten,
Kind regards,
Bien à vous,

Yves Vindevogel

Implements
Kempische Steenweg 206  --  3500 Hasselt  --  Belgium
Phone/Fax: +32 (11) 43.55.76  --  Mobile: +32 (478) 80.82.91
Mail: yves.vindevogel@implements.be  --  www.implements.be

Quote: The winner never says participating is more important than winning.

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


Re: Passing parameters from xsp to xsp

Posted by Lionel Crine <cr...@4dconcept.fr>.
I don't know if it's possible but why don't you try this :

<map:match pattern="db/*/*.xsp">
                <map:generate src="db/{1}/{2}.xsp" type="xsp"/>
          <map:transform src="xsl/db.generatexsp.xsl"/>
          <map:serialize type="xml"/>
</map:match>
<map:match pattern="db/*/*.html">
            <map:generate src="cocoon:/db/{1}/{2}.xsp"/>
           <map:serialize type="xml"/>
</map:match>


Lionel

At 22:44 17/03/2003 +0100, you wrote:
>Hi,
>
>I need to pass request parameters from one XSP to another
>
>This is my sitemap
>                         <map:match pattern="db/*/*.xsp">
>                                 <map:generate src="db/{1}/{2}.xsp" 
> type="xsp"/>
>                                 <map:transform src="xsl/db.generatexsp.xsl"/>
>                                 <map:serialize type="xml"/>
>                         </map:match>
>                         <map:match pattern="db/*/*.html">
>                                 <map:generate
>src="http://web/implements/db/{1}/{2}.xsp"/>
>
>                                 <map:serialize type="xml"/>
>                         </map:match>
>
>As you can see, I call the XSP from my call to the HTML.
>I need one XSP as a generator, because it must execute an ESQL query.
>But, the XSP called in that match (html match) calls another XSP that uses 
>the
>request parameters.
>
>However, they are not passed in that call.  I cannot use <map:parameter
>name="use-request-parameters"> since this is for a transformer.
>
>I need the same kind of thing, but for a generator.
>
>Anyone with an idea ??
>
>Some code:
>
>This is my XSP that is called:
><?xml version="1.0" encoding="ISO-8859-1"?>
><xsp:page language="java"
>                         xmlns:xsp="http://apache.org/xsp"
>                         xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>                         xmlns:xsp-session="http://apache.org/xsp/session/2.0"
>                         create-session="true">
>
>         <xml>
>                 <query>
>                         select fnSiteRegisteredUserInsert
>('<xsp-request:get-parameter name="email"/>',
>                                                 '<xsp-request:get-parameter
>name="password"/>')
>                 </query>
>                 <results>
>                         <result>
>                                 <value>0</value>
>                                 <message>You have been registered</message>
>                         </result>
>                 </results>
>                 <errors>
>                         <error>
>                                 <value>ERROR: Cannot insert a duplicate key
>into unique index tblsiteregistereduser_login_key</value>
>                                 <message>You already exist</message>
>                         </error>
>                 </errors>
>         </xml>
></xsp:page>
>
>As you can see, that needs the parameters.
>
>
>This is the XSL for transformation to a valid XSP
>
><?xml version="1.0" encoding="UTF-8"?>
><xsl:stylesheet version="1.0"
>         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>         xmlns:fo="http://www.w3.org/1999/XSL/Format"
>                         xmlns:xsp="http://apache.org/xsp"
>                         xmlns:esql="http://apache.org/cocoon/SQL/v2"
>                         xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>                         xmlns:xsp-session="http://apache.org/xsp/session/2.0"
>
> >
>
>         <xsl:template match="/xml">
>                 <xsp:page language="java" create-session="true">
>
>                         <xml>
>
>                         <esql:connection>
>                                 <esql:pool>implements</esql:pool>
>
>                                 <esql:execute-query>
>                                         <esql:query>
>                                                 <xsl:value-of 
> select="query"/>
>                                         </esql:query>
>
>                                         <esql:results>
>                                                 <esql:row-results>
>                                                         <result>
>
><esql:get-columns/>
>                                                         </result>
>                                                 </esql:row-results>
>                                         </esql:results>
>
>                                         <esql:error-results>
>
><error><esql:get-message/></error>
>                                         </esql:error-results>
>                                 </esql:execute-query>
>                         </esql:connection>
>
>                         </xml>
>                 </xsp:page>
>         </xsl:template>
></xsl:stylesheet>
>
>--
>Met vriendelijke groeten,
>Kind regards,
>Bien à vous,
>
>Yves Vindevogel
>
>Implements
>Kempische Steenweg 206  --  3500 Hasselt  --  Belgium
>Phone/Fax: +32 (11) 43.55.76  --  Mobile: +32 (478) 80.82.91
>Mail: yves.vindevogel@implements.be  --  www.implements.be
>
>Quote: The winner never says participating is more important than winning.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org


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