cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Goerg" <markus.go...@danet.de>
Subject Re: XSP/Java application init parameter with Cocoon
Date Wed, 12 Jul 2000 14:24:11 GMT


Robin Green schrieb:

> "Markus Goerg" <markus.goerg@danet.de> wrote:
> >Maybe someone does know ....
> >
> >What is the recommended way to give one's application (XSP and Java with
> >Cocoon) init parameters? With servlets, i would have used Global Init
> >Parameters or Servlet Init Parameters and read them e.g. using
> >ServletConfig.getInitParameter("key"). But this is out of scope with
> >Cocoon. Is it?
>
> No, it is available. In the XSP documentation in the distribution, it
> mentions standard variables that are available to every XSP page. One of
> these is servletContext.
>
> Note that you must do something like
>
> <xsp:page ...>
>   <page>
>     <xsp:logic>
>      servletContext.getInitParameter ("foobar")...
>     </xsp:logic>
>   </page>
> </xsp:page>
>
> not
>
> <xsp:page ...>
>   <xsp:logic>
>    private void myMethod () {
>      servletContext.getInitParameter ("foobar")
>    }
>   </xsp:logic>
>   <page>
>     ...
>   </page>
> </xsp:page>
>
> because the servletContext variable is only available within the page
> generation method (unless you explicitly pass it to a method as a method
> argument.)
>
> >What alternatives are available? Well, besides writing an
> >own property file - as a fallback option.
>
> Actually this doesn't work in JServ (without a replacement servlet runner
> e.g. Tomcat) because JServ on its own doesn't implement the servlet 2.2 API.
> In that case, yes, you would have to write your own properties file (but
> that's easy with java.util.Properties). But I assume you're not in that
> situation.

Thank you for your reply. Made things very clear.
Unfortunatelly, I *am* using JServ 1.1 and "servletContext.getInitParameter
("foobar")" is not available for me. New with servlet API 2.2 I assume. So I
have to go for the write-my-own-property-file thing.

>
>
> --
> Robin Green
> i-tao Ltd.
> 4 Skyline Village
> Limeharbour
> London E14 9TS
> United Kingdom
> Phone +44 20 7537 2233  Fax +44 70 8081 5118
> http://www.i-tao.com
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

--
Markus Görg,
Danet, GS-TA
Fon:   06151-868-294
Fax:   06151-868-663
Email: goerg@danet.de



Mime
View raw message