You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "James, Stuart" <st...@cazenove.com> on 2001/09/04 18:31:48 UTC

context-param [ hpux/nt tomcat 3.x & 4.x ]

Hi,

I want to access a "<context-param>" inside the  <context> tag of the main
server.xml file.

I can access  parameters inside the web.xml (stored in the web-inf)
directory, but that is stored inside the war/web project directory, how can
I access parameters declared in the main server.xml file.

Below is the code I use to iterate through the application parameters, so
what do I need to change for the top level context params ?

    java.util.Enumeration appIter = application.getInitParameterNames();
    while( appIter.hasMoreElements() )
    {
        String strName = (String)appIter.nextElement();
        out.println( "Application." + strName + "<BR>" );
    }

I have tried the config, session and page objects but they didn't work
either.

Thanks in advance 
Stuart.

PS, yes I have already searched the web & archives. :)


___________________________________________________
Email Disclaimer

This communication is for the attention of the
named recipient only and should not be passed
on to any other person. Information relating to
any company or security, is for information
purposes only and should not be interpreted as
a solicitation or offer to buy or sell any security.
The information on which this communication is based
has been obtained from sources we believe to be reliable,
but we do not guarantee its accuracy or completeness.
All expressions of opinion are subject to change
without notice.  All e-mail messages, and associated attachments,
are subject to interception and monitoring for lawful business purposes.
___________________________________________________

TOMCAT 4 - passing parameters to servlets

Posted by paul <pa...@roadrunner.uk.com>.
Hi

The orginal message section below answers my  question posted some time ago
but
I am not sure, could you please verify?
This is a shame because one of the reasons I went over to tomcat 4 is
because I thought it
might solve this problem.

I have a servlet in a context that needs to be accessed from many virtual
hosts via apache.

The value of the parameters I pass to my servlet need to be different
depending on which virtual host was active.

If I put the parameters in the web.xml for the context then the values will
be the same irrespective of host
so I have been trying to use parameter elements in the server.xml file with
absolutly no success.

I have been unable to find any documentation on the Environment, Parameter
or ResourceParams tags used in
the example server.xml supplied on installation.

Is want I want to do possible?
If so, how please with example

Thanks for any help

Paul

----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: <to...@jakarta.apache.org>
Sent: Tuesday, September 04, 2001 8:12 PM
Subject: Re: context-param [ hpux/nt tomcat 3.x & 4.x ]


> There is no current support for setting context initialization parameters
> in the server.xml file for any version of Tomcat.  If you'd like to
> propose this, please submit an enhancement request to the bug tracking
> system (under product category "Tomcat 3" or "Tomcat 4" as appropriate):
>
>   http://nagoya.apache.org/bugzilla/
>
> Craig McClanahan
>
>
> On Tue, 4 Sep 2001, James, Stuart wrote:
>
> > Date: Tue, 4 Sep 2001 17:31:48 +0100
> > From: "James, Stuart" <st...@cazenove.com>
> > Reply-To: tomcat-user@jakarta.apache.org
> > To: "'tomcat-user@jakarta.apache.org'" <to...@jakarta.apache.org>
> > Subject: context-param [ hpux/nt tomcat 3.x & 4.x ]
> >
> > Hi,
> >
> > I want to access a "<context-param>" inside the  <context> tag of the
main
> > server.xml file.
> >
> > I can access  parameters inside the web.xml (stored in the web-inf)
> > directory, but that is stored inside the war/web project directory, how
can
> > I access parameters declared in the main server.xml file.
> >
> > Below is the code I use to iterate through the application parameters,
so
> > what do I need to change for the top level context params ?
> >
> >     java.util.Enumeration appIter = application.getInitParameterNames();
> >     while( appIter.hasMoreElements() )
> >     {
> >         String strName = (String)appIter.nextElement();
> >         out.println( "Application." + strName + "<BR>" );
> >     }
> >
> > I have tried the config, session and page objects but they didn't work
> > either.
> >
> > Thanks in advance
> > Stuart.
> >
> > PS, yes I have already searched the web & archives. :)
> >
> >
> > ___________________________________________________
> > Email Disclaimer
> >
> > This communication is for the attention of the
> > named recipient only and should not be passed
> > on to any other person. Information relating to
> > any company or security, is for information
> > purposes only and should not be interpreted as
> > a solicitation or offer to buy or sell any security.
> > The information on which this communication is based
> > has been obtained from sources we believe to be reliable,
> > but we do not guarantee its accuracy or completeness.
> > All expressions of opinion are subject to change
> > without notice.  All e-mail messages, and associated attachments,
> > are subject to interception and monitoring for lawful business purposes.
> > ___________________________________________________
> >
>


Re: context-param [ hpux/nt tomcat 3.x & 4.x ]

Posted by "Craig R. McClanahan" <cr...@apache.org>.
There is no current support for setting context initialization parameters
in the server.xml file for any version of Tomcat.  If you'd like to
propose this, please submit an enhancement request to the bug tracking
system (under product category "Tomcat 3" or "Tomcat 4" as appropriate):

  http://nagoya.apache.org/bugzilla/

Craig McClanahan


On Tue, 4 Sep 2001, James, Stuart wrote:

> Date: Tue, 4 Sep 2001 17:31:48 +0100
> From: "James, Stuart" <st...@cazenove.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: "'tomcat-user@jakarta.apache.org'" <to...@jakarta.apache.org>
> Subject: context-param [ hpux/nt tomcat 3.x & 4.x ]
>
> Hi,
>
> I want to access a "<context-param>" inside the  <context> tag of the main
> server.xml file.
>
> I can access  parameters inside the web.xml (stored in the web-inf)
> directory, but that is stored inside the war/web project directory, how can
> I access parameters declared in the main server.xml file.
>
> Below is the code I use to iterate through the application parameters, so
> what do I need to change for the top level context params ?
>
>     java.util.Enumeration appIter = application.getInitParameterNames();
>     while( appIter.hasMoreElements() )
>     {
>         String strName = (String)appIter.nextElement();
>         out.println( "Application." + strName + "<BR>" );
>     }
>
> I have tried the config, session and page objects but they didn't work
> either.
>
> Thanks in advance
> Stuart.
>
> PS, yes I have already searched the web & archives. :)
>
>
> ___________________________________________________
> Email Disclaimer
>
> This communication is for the attention of the
> named recipient only and should not be passed
> on to any other person. Information relating to
> any company or security, is for information
> purposes only and should not be interpreted as
> a solicitation or offer to buy or sell any security.
> The information on which this communication is based
> has been obtained from sources we believe to be reliable,
> but we do not guarantee its accuracy or completeness.
> All expressions of opinion are subject to change
> without notice.  All e-mail messages, and associated attachments,
> are subject to interception and monitoring for lawful business purposes.
> ___________________________________________________
>