You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Harlan Hile <ha...@otelnet.com> on 2000/10/06 02:06:23 UTC
webapplication-level properties
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.
----
harlan@otelnet.com
Re: webapplication-level properties
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
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