tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Suttor <Jeff.Sut...@eng.sun.com>
Subject Tomcat: jsp: config.getInitParameter()
Date Wed, 05 Apr 2000 16:18:34 GMT
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>
...

debug.jsp:

<%@ page import="java.util.Enumeration" %>

<%

		out.println("<pre>");
		out.println("from config");

		String arg;
		String val;

		Enumeration enum = config.getInitParameterNames();
		while( enum.hasMoreElements() ) {
		    arg = (String)enum.nextElement();
                    val = config.getInitParameter(arg);               
                    out.println(arg + " = " + val);
                }

		out.println("</pre>");
%>



Mime
View raw message