RE: init params

2001-05-12 Thread Tim Endres

> Thanks for the quick posts.
> 
> Stupid me, I thought getInitParameter would always be for init-params.
> 
> I wonder why...
> getServletContext.getInitParameter(String):String
> is not
> getServletContext.getContextParameter(String):String ?

Because getInitParameter() was invented before contexts ever existed.
tim.





RE: init params

2001-05-12 Thread cybermaster

I used to have similar problems as Russ - IMHO the naming of ServletContext
is wrong - the context is the web-application and not the servlet that's
returned by getServletContext. Obviously the powers who created the API cut
the naming of the function short - getContextServletIsIn - is what they
meant.

The grammatical construct "SomethingContext" usually is considered to name
the Context - which to repeat myself is the web app. ServletConfig contains
the parameters in the Context of the Servlet

Wish Sun would reconsider the naming of some of these classes and methods
...

--peter

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jason Coward
Sent: Saturday, May 12, 2001 11:46 AM
To: Orion-Interest
Subject: RE: init params

Russ:

The first two methods...

 * getInitParameter(String):String
 * config.getInitParameter(String):String

both reference the ServletConfig.getInitParameter(String):String method.
This
returns configuration information specified by an  element
within a
 definition.

The other method...

 * getServletContext.getInitParameter(String):String

references ServletContext.getInitParameter(String):String. which retrieves
parameter values from the  element of a  definition.

Check out the Servlet API JavaDocs or specification docs for more info.

Jason Coward
Technical Relationship Manager
Mongoose Technology, Incorporated

| -Original Message-
| From: [EMAIL PROTECTED]
| [mailto:[EMAIL PROTECTED]]On Behalf Of Russ White
| Sent: Saturday, May 12, 2001 9:08 AM
| To: Orion-Interest
| Subject: init params
|
|
| Found something unexpected.
|
| I have attached an ear to illustrate.
|
| In the servlet TestServlet (config provided for expediency).
|   
|   test
|   test
|   com.sequenet.mvc.TestServlet
|   
|   config
|   test
|   
|   1
|   
| I try to get an init-param three ways.
|
| System.err.println("param="+getInitParameter("config"));
| System.err.println("param="+config.getInitParameter("config"));
|
|
System.err.println("param="+getServletContext().getInitParameter("config"));
|
| the first two print "test" as they should.
| the last one print "null".
|
| why?
|
| Just for kicks I performed this test in both the init() method and a
service()
| method.
|
| Any thoughts?
|
| WR
| Russ White
|
|






RE: init params

2001-05-12 Thread Russ White

Thanks for the quick posts.

Stupid me, I thought getInitParameter would always be for init-params.

I wonder why...
getServletContext.getInitParameter(String):String
is not
getServletContext.getContextParameter(String):String ?

not that it matters.

Thanks again.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jason Coward
Sent: Saturday, May 12, 2001 1:46 PM
To: Orion-Interest
Subject: RE: init params


Russ:

The first two methods...

 * getInitParameter(String):String
 * config.getInitParameter(String):String

both reference the ServletConfig.getInitParameter(String):String method.  This
returns configuration information specified by an  element within a
 definition.

The other method...

 * getServletContext.getInitParameter(String):String

references ServletContext.getInitParameter(String):String. which retrieves
parameter values from the  element of a  definition.

Check out the Servlet API JavaDocs or specification docs for more info.

Jason Coward
Technical Relationship Manager
Mongoose Technology, Incorporated

| -Original Message-
| From: [EMAIL PROTECTED]
| [mailto:[EMAIL PROTECTED]]On Behalf Of Russ White
| Sent: Saturday, May 12, 2001 9:08 AM
| To: Orion-Interest
| Subject: init params
|
|
| Found something unexpected.
|
| I have attached an ear to illustrate.
|
| In the servlet TestServlet (config provided for expediency).
|   
|   test
|   test
|   com.sequenet.mvc.TestServlet
|   
|   config
|   test
|   
|   1
|   
| I try to get an init-param three ways.
|
| System.err.println("param="+getInitParameter("config"));
| System.err.println("param="+config.getInitParameter("config"));
|
| System.err.println("param="+getServletContext().getInitParameter("config"));
|
| the first two print "test" as they should.
| the last one print "null".
|
| why?
|
| Just for kicks I performed this test in both the init() method and a service()
| method.
|
| Any thoughts?
|
| WR
| Russ White
|
|






Re: init params

2001-05-12 Thread Kesav Kumar

You have given init parameter to the servlet thats the reason your first two
statements given correct result.  The thrird one looks for the context
parameter which you haven't set.  Refer the difference between the
ServletInitParameter and the Context-Parameter.

For contextparameter you have give


contextP
ContextValue

- Original Message -
From: "Russ White" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Saturday, May 12, 2001 7:08 AM
Subject: init params


> Found something unexpected.
>
> I have attached an ear to illustrate.
>
> In the servlet TestServlet (config provided for expediency).
> 
> test
> test
> com.sequenet.mvc.TestServlet
> 
> config
> test
> 
> 1
> 
> I try to get an init-param three ways.
>
> System.err.println("param="+getInitParameter("config"));
> System.err.println("param="+config.getInitParameter("config"));
>
System.err.println("param="+getServletContext().getInitParameter("config"));
>
> the first two print "test" as they should.
> the last one print "null".
>
> why?
>
> Just for kicks I performed this test in both the init() method and a
service()
> method.
>
> Any thoughts?
>
> WR
> Russ White
>
>
>




RE: init params

2001-05-12 Thread Jason Coward

Russ:

The first two methods...

 * getInitParameter(String):String
 * config.getInitParameter(String):String

both reference the ServletConfig.getInitParameter(String):String method.  This
returns configuration information specified by an  element within a
 definition.

The other method...

 * getServletContext.getInitParameter(String):String

references ServletContext.getInitParameter(String):String. which retrieves
parameter values from the  element of a  definition.

Check out the Servlet API JavaDocs or specification docs for more info.

Jason Coward
Technical Relationship Manager
Mongoose Technology, Incorporated

| -Original Message-
| From: [EMAIL PROTECTED]
| [mailto:[EMAIL PROTECTED]]On Behalf Of Russ White
| Sent: Saturday, May 12, 2001 9:08 AM
| To: Orion-Interest
| Subject: init params
|
|
| Found something unexpected.
|
| I have attached an ear to illustrate.
|
| In the servlet TestServlet (config provided for expediency).
|   
|   test
|   test
|   com.sequenet.mvc.TestServlet
|   
|   config
|   test
|   
|   1
|   
| I try to get an init-param three ways.
|
| System.err.println("param="+getInitParameter("config"));
| System.err.println("param="+config.getInitParameter("config"));
|
| System.err.println("param="+getServletContext().getInitParameter("config"));
|
| the first two print "test" as they should.
| the last one print "null".
|
| why?
|
| Just for kicks I performed this test in both the init() method and a service()
| method.
|
| Any thoughts?
|
| WR
| Russ White
|
|