Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

access servletconfig - web.xml

843835May 23 2003 — edited May 23 2003
hi,
is there any way to access the servletconfig from jsp, using the web.xml data. i want to allow my jsp page to read in a file path, but don't want it in the code, someone else will be changing the path and does not wish to touch the code. i've tried but no luck:
web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
	PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
	"http://java.sun.com/j2ee/dtds/web-app_2.2dtd">

<web-app>
	<servlet>
		<servlet-class>ReadList</servlet-class>
		<init-param>
			<param-name>Path</param-name>
			<param-value>TEst</param-value>
		</init-param>
	</servlet>
</web-app>

.jsp file:
String str = getInitParameter("Path");
out.print(str);
always get null returned. any ideas? the file is a jsp not a servlet, i wasn't sure how to map a jsp so i used the <servlet-class> assuming that since a jsp get complied into a servlet it would work, but doesn't.

Thanks.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 20 2003
Added on May 23 2003
4 comments
162 views