• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

problem with config implicit variable

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a simple jsp file which is supposed to print the servlet name and a parameter name when accessed form the config variable. I am using tomcat4.1.

My Jsp file is as follows :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ page info="a hello world example" %>
<%@ page language="java" %>
<%@ page contentType="text/html;charset=ISO-8859-1" %>
<%@ page pageEncoding="ISO-8859-1" %>
<%@ page session="true" %>
<%@ page errorPage="null" %>
<%@ page isErrorPage="false" %>
<%@ page isThreadSafe="false" %>
<%@ page buffer="32kb" autoFlush="true" %>
<%@ page import="java.io.*" %>

<html>
<head><title> *** Hello, World ***</title></head>
<body>

<table>
<tr>
<td>config</td>
<td><%=config.getServletName()%> </td>
<td><%=config.getInitParameter("reason")%></td>
</tr>
</table>

</body>
</html>

and my web.xml is as follows:
<web-app>
<servlet>
<servlet-name>Example1</servlet-name>
<jsp-file>/test.jsp </jsp-file>

<init-param>
<param-name>reason</param-name>
<param-value>Learning JSP</param-value>
</init-param>
</servlet>

</web-app>

- I am expecting the result to be
config Example1 Learning JSP

- but the actual response I get is :
config jsp null

does any one know why this is happening?

thanks
aparna
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!