On Fri, 27 Oct 2000, Craig R. McClanahan wrote:

> Paul Hoepfner-Homme wrote:
> 
> > Sorry, typo in web.xml below.  I had
> > <servlet-param>MyServlet</servlet-param> before, but it should be
> > <servlet-class> obviously.  I have fixed it below.
> >
> >> Finally, I'm not alone!!  I have 3.2 beta 6 as well.
> >> [..post elided..]
> >> I can access the "test1" parameter by calling
> >> getServletConfig().getServletContext().getInitParameter("test1").


> >
> What request URI are you trying to use to access this servlet?  If you
> are trying something like:
> 
>     http://localhost:8080/myapp/servlet/myservlet
> 
> or
> 
>     http://localhost:8080/myapp/servlet/MyServlet
> 
> (where "/myapp" is the context path of your application), it is not
> going to work.  The reason is that "/servlet/myservlet" runs the invoker
> servlet, which indirectly loads and executes yours.  To access servlet
> initialization parameters, you will also need to add a servlet mapping
> for this servlet, and then call it.  Add this to the bottom of your
> web.xml (before the </web-app> entry)
> 
>     <servlet-mapping>
>         <servlet-name>myservlet</servlet-name>
>         <url-pattern>/foo/*</url-pattern>
>     </servlet-mapping>
> 
> and then execute:
> 
>     http://localhost:8080/myapp/foo
> 
> and see what happens.
> 
> NOTE:  It is quite possible that some servlet containers will return
> initialization parameters for a servlet accessed via something like
> "/servlet" anyway.  That's legal, because the whole idea of an "invoker"
> servlet is not in the servlet spec, and is therefore not guaranteed to
> be portable.  Using a servlet mapping and executing your servlet that
> way, on the other hand, *is* in the spec and will work on any 2.2 or 2.3
> compliant servlet container.
> 
> Craig McClanahan
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to