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: webapplication-level properties
Date Fri, 06 Oct 2000 00:26:07 GMT
Harlan Hile wrote:

> I would like to have several jsp pages that share one bean, and I would
> like some way to configure this bean through tomcat.  the <env-entry> tag
> looked promising, but when I put them in, tomcat told me
>   XmlMapper: Can't find method addTaglib in
>   Ctx(/notification,webapps/notification) CLASS class
>   org.apache.tomcat.core.Context
> I tried to access the parameters anyway, as specified in the J2EE 1.2
> specifications, page 5-4.  This first caused an exception that it couldnt
> find an ORB.  I started tnameserv, and tried again and got a null pointer
> exception.
> Anyone have suggestions on how to do this?  I want something like the
> servlet init-param's, but that doesnt require the class to be a servlet.
> thanks.
>

The <env-entry> stuff is not supported by Tomcat stand-alone (that is, when
it's not embedded in a J2EE container).

Your best bet would be to use context initialization parameters -- they are
configured like this:

    <context-param>
        <param-name>myname</param-name>
        <param-value>the value</param-value>
    </context-param>

and are accessed from the servlet context like this (in a servlet):

    String value = getServletContext().getInitParameter("myname");

or like this in a JSP scriptlet:

    <%
        String value =
            application.getInitParameter("myname");
    %>

>
> ----
> harlan@otelnet.com

Craig McClanahan

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



Mime
View raw message