cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Morrison, John" <John.Morri...@uk.experian.com>
Subject RE: [C2] How to get web.xml parameters in an XSP ... ?
Date Tue, 07 Aug 2001 08:22:44 GMT
You can do something like this...

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
  <display-name>display</display-name>
  <description>description</description>
  
  <context-param>
    <param-name>param1</param-name>
    <param-value>some value here</param-value>
    <description>a better description here</description>
  </context-param>
...
</web-app>


and access it in your xsp like

<xsp:expr>context.getInitParameter("param1")</xsp:expr>

'cause I put the code in there! ;)

J.

> -----Original Message-----
> From: Peter Royal [mailto:proyal@managingpartners.com]
> Sent: Friday, 03 August 2001 8:11 pm
> To: cocoon-users@xml.apache.org
> Subject: Re: [C2] How to get web.xml parameters in an XSP ... ?
> 
> 
> At 12:05 PM 8/3/2001 -0700, Rick Tessner wrote:
> >Is there any way to grab the <init-param> parameters defined 
> in the web.xml
> >via an XSP?  Or is this be considered a big no-no?
> 
> There is not a way currently, but you could do it if you 
> wanted to dig a bit :)
> 
> Those parameters are read in the CocoonServlet class 
> (org.apache.cocoon.servlet package). Values in there are 
> stuffed into the 
> Context (an avalon context, not servlet).
> 
> You could modify that class to put those parameters into the 
> Context, but 
> then you have to get them out. AFAIK an XSP page is not 
> Contextualizable 
> (an Avalon interface). You could give it that by modifying 
> the styleshete 
> used to create the compiled XSP forms.
> 
> So yes, its possible, but it would take some legwork. It 
> might be nice to 
> have a generic way to pass parameters to an instance of 
> cocoon via web.xml, 
> maybe via the context. I'm sure if you wrote that the 
> developers would 
> consider the patch.
> -pete
> 
> -- 
> peter royal -> proyal@managingpartners.com
> managing partners, inc. -> http://www.managingpartners.com
> 
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> 


=======================================================================
Information in this email and any attachments are confidential, and may
not be copied or used by anyone other than the addressee, nor disclosed
to any third party without our permission.  There is no intention to
create any legally binding contract or other commitment through the use
of this email.

Experian Limited (registration number 653331).  
Registered office: Talbot House, Talbot Street, Nottingham NG1 5HF

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.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