Just to clear up what i'm trying to do:
not having any problems getting init parameters using servlets, the following code in web.xml will achieve that:

<servlet>
        <servlet-name>MyServlet</servlet-name>
        <servlet-class>MyServlet</servlet-class>
        <init-param>
                <param-name>debug</param-name>
                <param-value>true</param-value>
        </init-param>
</servlet>

The problem is accessing init-params exclusively in JSPs without any servlets at all. In theory this should be possible as a JSP is a servlet but it's proving very difficult to do this.

Right now i'm working on a background servlet for the JSP to make these init-params possible. I'll post solution when it's done.


Bo Xu <[EMAIL PROTECTED]>

03/08/01 10:09 AM
Please respond to tomcat-user

       
        To:        [EMAIL PROTECTED]
        cc:        
        Subject:        Re: config.getInitParameter() still returning null



Milt Epstein wrote:

> [ ... ]
>
> I could be wrong, but I don't believe you have to define
> servlet-mapping's to get init-param's to work, just having defined the
> servlet is sufficient.  However, in the URL, you do need to use the
> specific servlet-name you used in the servlet definition.  (That's
> because you can define the same servlet class multiple times, with
> different servlet-name's and different init-param's.)
>
> So, according to the above web.xml, the URL that should be used is:
>
> http://your.domain.com/yourwebappname/servlet/Error
> [...]

thanks for your email :-)  and now I find mistake in my last email,
the following is my new understanding about Servlet(not JSP) with
jakarta-tomcat-4.0-b1 :

0  if we don't define any "named" servlet definition
   in webapps/myapp/WEB-INF/web.xml, then we can invoke
   MyServlet with the following  way:
   http://localhost:8080/myapp/servlet/MyServlet
   it will invoke the "default/non-named" servlet definition

1  if we define the following in webapps/myapp/WEB-INF/web.xml:
    ...
    <servlet-name>MyServlet_sn </servlet-name>
    ...
   then we Also can invoke this servlet definition with this servlet-name:
   http://localhost:8080/myapp/servlet/MyServlet_sn

2 if we also define a servlet-mapping:
   <servlet-mapping>
    <servlet-name>MyServlet_sn </servlet-name>
       <url-pattern> /MyServlet_up</url-pattern>
   </servlet-mapping>
   then we Also can invoke this servlet definition with this url-pattern:
   http://localhost:8080/myapp/MyServlet_up

   and 1 and 2 will invoke the same "named" servlet definition whose
   name is MyServlet_sn.

3  from a email in "List.this" ^_^ ,  I find:
   if we directly use "MyServlet" as the servlet-name, and we invoke
   with the following way:
   http://localhost:8080/myapp/servlet/MyServlet
  we will goto that "named" servlet definition whose name is
  "MyServlet"-> we will Not goto that "default/non-named"
  servlet definition.

hope the above is right, otherwise I need to correct my
"experience notebook" Again :-)  or I need to use a pencial
instead of a pen?  :-)


Bo
Mar.08, 2001



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



Reply via email to