Tomcat 4.0.3 - <init-param> always returns null for JSP
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mike_Barlotta
Posted On:   Tuesday, May 28, 2002 02:30 PM

When using the init param I cannot get anything but a null value to return. Is this a bug or am I missing something... JSP code <%@ page language="java" %> <%@ page import="javax.naming.*" %> <% String contextFactory = config.getInitParameter("initial.context.factory"); String providerURL = config.getInitParameter("provider.url"); %> Initial.Context.Factory: <%= contextFactory %> Provider.URL: <%= providerURL %> WAR file snippet    More>>

When using the init param I cannot get anything but a null value to return. Is this a bug or am I missing something...


JSP code

			
<%@ page language="java" %>

<%@ page import="javax.naming.*" %>




<%

String contextFactory = config.getInitParameter("initial.context.factory");
String providerURL = config.getInitParameter("provider.url");


%>



Initial.Context.Factory: <%= contextFactory %>


Provider.URL: <%= providerURL %>







WAR file snippet

			

XXX
XXX
XXX.jsp

initial.context.factory
com.xxx.ejb.InitialContextFactory


provider.url
iiop://localhost:9000




TIA

-Mike    <<Less

Re: Tomcat 4.0.3 - &lt;init-param&gt; always returns null for JSP

Posted By:   michael_dean  
Posted On:   Monday, June 3, 2002 02:43 PM

Assuming you have properly specified your element value (i.e. must be a relative URL starting with a "/"), you will need to access the page using the URI /servlet/XXX to have access to the servlet initialization parameters.



If you would like to use a different URI to access the page, provide a element (in your web.xml file) specifying the name you would like to use, i.e.:





XXX
/desired/uri



As a matter of fact, if you want to access the page such that it looks like you are directly accessing the JSP, just "remap" the servlet to the JSP file's URL, i.e.:





XXX
/XXX.jsp



Enjoy.

About | Sitemap | Contact