cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: Parameters for Actions
Date Wed, 06 Nov 2002 12:47:22 GMT
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
bruno@outerthought.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