0
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<servlet>
  <servlet-name>InitializationJSP</servlet-name>
  <jsp-file>/initialization.jsp</jsp-file>
  <init-param>
    <param-name>testParam</param-name>
    <param-value>hello from web.xml</param-value>
  </init-param>
</servlet>
<servlet-mapping>
  <servlet-name>InitializationJSP</servlet-name>
  <url-pattern>/Initialization</url-pattern>
</servlet-mapping>
</web-app>

initialization.jsp

<html>
<head>
<title>Initialization Parameters and JSP</title>
</head>
<body>
This page has retrieved the following initialization parameter from web.xml:
<br>
<%= pageContext.getServletConfig().getInitParameter("testParam") %>
</body>
</html>

My directory structure is

sample
   Initialization.jsp
   WEB-INF
      web.xml
      classes/
      lib/

Is there any problem? This jsp file is not running when i run this using tomcat and appending /initialization after the application url.

1 Answer 1

1

change this
<jsp-file>/initialization.jsp</jsp-file>
to
<jsp-file>/Initialization.jsp</jsp-file>

2
  • Yes you are correct. But still my application is not running. Commented Feb 28, 2012 at 10:49
  • There was some other problem. Thanks for response. Commented Feb 28, 2012 at 11:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.