tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: Tomcat: jsp: config.getInitParameter()
Date Wed, 05 Apr 2000 16:27:55 GMT
See below for comments.

Jeff Suttor wrote:

> I am trying to access the <init-param> in web.xml values from a *.jsp.
> The following code samples do not work as expected.
> They do not return any values.
> Any ideas?
>
> Thanks,
>
> --
> Jeff.Suttor@Sun.com
> XML Technology Center
>
> from web.xml:
> ...
>     <servlet>
>         <servlet-name>
>             jsp
>         </servlet-name>
>         <servlet-class>
>             org.apache.jasper.runtime.JspServlet
>         </servlet-class>
>         <init-param>
>             <param-name>foo</param-name>
>             <param-value>bar</param-value>
>         </init-param>
>         <load-on-startup>
>             -2147483646
>         </load-on-startup>
>     </servlet>
>

What you are doing here is setting an init parameter for the JSP page compiler
servlet itself, not for your individual JSP page.  To do that, you would do
something like this (it's supposed to work, but I haven't personally tried
it):

<servlet>
    <servlet-name>MyJspPage</servlet-name>
    <jsp-file>/debug.jsp</jsp-file>                <-- The full
context-relative path
    <init-param>
        <param-name>foo</param-name>
        <param-value>bar</param-value>
    </init-param>
</servlet>

That way, the foo=bar initialization applies to this specific JSP page, just
like (with servlets) it applies to the specific servlet you identify.

Craig McClanahan



Mime
View raw message