Thank you Bruno for these informations.

I tried to put init parameters in the web.xml like this :

    <init-param>
      <param-name>srvImpDirName</param-name>
      <param-value>webapps/cocoon/samples/srvimp/content/xml/</param-value>
    </init-param>

...and to read it in Action like this :
  dirName =
ObjectModelHelper.getContext(objectModel).getInitParameter("srvImpDirName");

but my result is 'null'. An idea ?

Ludovic


----- Original Message -----
From: "Bruno Dumon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 06, 2002 1:47 PM
Subject: Re: Parameters for Actions


> On Wed, 2002-11-06 at 11:50, Ludovic de Beaurepaire wrote:
> > Hi All,
> >
> > I don't find in documentation how to pass to an Action some parameters
> > defined in one of the configuration files (web.xml, cocoon.xconf or
> > sitemap.xmap). Someone knows ?
> >
>
> the parameters given in the sitemap to the action, such as in:
>
> <map:act type="myaction">
>   <map:parameter name="foo" value="bar"/>
> </map:act>
>
> are passed as a "par" argument in the act method of the Action.
>
> Parameters (or actually "configurations") defined in de cocoon.xconf
> can't be read directly by actions, since those are used to configure
> specific components to which those configurations map (via the roles
> file, see the avalon documentation for how that works).
>
> Init parameters declared in the web.xml should be accessible through the
> standard servlet interfaces, thus in your action you would do something
> like:
> ObjectModelHelper.getContext(objectModel).getInitParameter("myparam")
> (objectModel is an argument supplied in the act method)
>
> Configuration for the action specified inside the component declaration
> in the map:actions element, such as in:
>
> <map:components>
>  ....
>  <map:actions>
>    <map:action name="foo" src="com.bar.FooAction">
>      <myparam>hello</myparam>
>    </map:action>
>    ....
>  </map:actions>
> </map:components>
>
> are accessible by implementing the "Configurable" interface (from
> Avalon) in your Action. (this is again described in the Avalon
> documentation)
>
> --
> Bruno Dumon                             http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> 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:     <[EMAIL PROTECTED]>
> For additional commands, e-mail:   <[EMAIL PROTECTED]>
>
>
>




---------------------------------------------------------------------
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:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to