You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Diego Cattelan <ne...@libero.it> on 2003/09/17 17:41:02 UTC

Parameters

Hi
I'm new to Cocoon system and I don't understand how to pass parameters from
sitemap:
-----------------------------------------------------------
sitemap.xmap:
-----------------------------------------------------------
....
       <map:match pattern="auth_entra">
        <map:generate src="../globals/authentication/auth.xsp" type="serverpages">
            <map:parameter name="username" value="topolino"/>
            <map:parameter name="password" value="topolinopw"/>
            <map:parameter name="action" value="entraTest"/>
        </map:generate>
        <map:serialize type="xml"/>
      </map:match>
....
----------------------------------------------------------
auth.xsp:
----------------------------------------------------------
<xsp:page language="java"
    xmlns:xsp="http://apache.org/xsp"
    xmlns:esql="http://apache.org/cocoon/SQL/v2"
    xmlns:xsp-request="http://apache.org/xsp/request/2.0">
    
    <authentication>
        username =  <xsp-request:get-parameter name="username"/>
    </authentication>

</xsp:page>

I'm unable to find any hints on the docs.

Thankyou

Re: Parameters

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 17.Sep.2003 -- 05:41 PM, Diego Cattelan wrote:
> Hi
> I'm new to Cocoon system and I don't understand how to pass parameters from
> sitemap:
> sitemap.xmap:
> ....
>        <map:match pattern="auth_entra">
>         <map:generate src="../globals/authentication/auth.xsp" type="serverpages">
>             <map:parameter name="username" value="topolino"/>
>             <map:parameter name="password" value="topolinopw"/>
>             <map:parameter name="action" value="entraTest"/>
>         </map:generate>
>         <map:serialize type="xml"/>
>       </map:match>
> ....
> auth.xsp:
> <xsp:page language="java"
>     xmlns:xsp="http://apache.org/xsp"
>     xmlns:esql="http://apache.org/cocoon/SQL/v2"
>     xmlns:xsp-request="http://apache.org/xsp/request/2.0">
>     
>     <authentication>
>         username =  <xsp-request:get-parameter name="username"/>

Alright, xsp-request:get-parameter refers to request parameters
(i.e. submitted with a form) but you're interested in sitemap
parameters. If you prefer to use a logicsheet to read them, use the
util logicsheet tag 

   <util:get-sitemap-parameter name="username"/>

if you prefer to do in in JAVA (you shouldn't), it's

   parameters.getParameter("username", "default")

See Apache Avalon Framework API docs on Parameter for all ways to
access parameters and their implications.

I'm afraid that input modules don't have access to sitemap
parameters.

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

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


Re: Parameters

Posted by Luca Morandini <lu...@tin.it>.
Diego Cattelan wrote:
> Hi
> I'm new to Cocoon system and I don't understand how to pass parameters from
> sitemap:

Have you already looked into the input-modules ?
They're quite handy, see 
http://cocoon.apache.org/2.1/userdocs/concepts/modules.html for details, 
and don't forget to look at the samples (http://<your 
server>>/samples/modules/index.xsp), of which there are plenty.

Regards,

------------------------------------------
                Luca Morandini
                GIS Consultant
               lmorandini@ieee.org
http://space.virgilio.it/kumora/index.html
------------------------------------------



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


XML-Form and XML-Scheme

Posted by ma...@student.uni-ulm.de.
Hi,
does anyone have experience in using XML-Scheme as base for generating XML-
Forms and the equivalent Schematron data?
Has anyone implemented a XML-Schema Validator?
Thanks in advance, 
Mat

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


Re: Parameters

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 17.Sep.2003 -- 11:07 AM, jcplerm wrote:
> I implemented an action to set an attribute on the request object which looks like:
> 
>    <map:act type="SetRequestAttributeAction">
>                 <map:parameter name="requestAttributeName" value="attr1"/>
>                 <map:parameter name="requestAttributeValue" value="1000"/>
>             ...
>     </map:act>
> 
> Can output modules somehow be used to do the same thing as above?
> Are there any other ways/ideas of doing it?

There is an output module that writes to request attributes. However,
output modules are not directly accessible from the sitemap. One could
think of a generic action like the one you wrote that sets attributes
using output modules. That way this action could be used to set
e.g. session attributes and more (thinking, would it make sense to
have an response output module then, perhaps based on JXPath?)

The "TestAction.java" in src/samples/org/apache/cocoon/acting/modular/
might be useful as a blueprint for such an action, although it
focusses on testing input modules it does use output modules as well.
Just mind that output modules may require a final "commit()" before
data is actually placed in the designated store.

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

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


Re: Parameters

Posted by jcplerm <jc...@ameritech.net>.
I implemented an action to set an attribute on the request object which looks like:

   <map:act type="SetRequestAttributeAction">
                <map:parameter name="requestAttributeName" value="attr1"/>
                <map:parameter name="requestAttributeValue" value="1000"/>
            ...
    </map:act>

Can output modules somehow be used to do the same thing as above?
Are there any other ways/ideas of doing it?

Thanks,

jlerm
  ----- Original Message ----- 
  From: Diego Cattelan 
  To: users@cocoon.apache.org 
  Sent: Wednesday, September 17, 2003 10:41 AM
  Subject: Parameters


  Hi
  I'm new to Cocoon system and I don't understand how to pass parameters from
  sitemap:
  -----------------------------------------------------------
  sitemap.xmap:
  -----------------------------------------------------------
  ....
         <map:match pattern="auth_entra">
          <map:generate src="../globals/authentication/auth.xsp" type="serverpages">
              <map:parameter name="username" value="topolino"/>
              <map:parameter name="password" value="topolinopw"/>
              <map:parameter name="action" value="entraTest"/>
          </map:generate>
          <map:serialize type="xml"/>
        </map:match>
  ....
  ----------------------------------------------------------
  auth.xsp:
  ----------------------------------------------------------
  <xsp:page language="java"
      xmlns:xsp="http://apache.org/xsp"
      xmlns:esql="http://apache.org/cocoon/SQL/v2"
      xmlns:xsp-request="http://apache.org/xsp/request/2.0">
      
      <authentication>
          username =  <xsp-request:get-parameter name="username"/>
      </authentication>

  </xsp:page>

  I'm unable to find any hints on the docs.

  Thankyou