Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with config implicit variable  RSS feed

 
Apu Shah
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!