I have a query regarding Initializing the
jsp(P 308).
I have used the following
servlet mapping in web.xml
<servlet>
<servlet-name>
Tomcat</servlet-name>
<jsp-file>/HFSJ/ch07/TestInit.jsp</jsp-file>
<init-param>
<param-name>name</param-name>
<param-value>chaurasia</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Tomcat</servlet-name>
<url-pattern>/Tomcat/*</url-pattern>
</servlet-mapping>
If i am calling the resource (TestInit.jsp) using
http://localhost:8080/scwcd/Tomcat, then i am getting result as expected, but if i am calling the same resource using
http://localhost:8080/scwcd/HFSJ/ch07/TestInit.jsp then i am getting the value of name as null.
code for TestInit.jsp
<%!
String name;
public void jspInit(){
ServletConfig config = getServletConfig();
ServletContext context = getServletContext();
name = config.getInitParameter("name");
}
%>
<%=name%>
can someone tell me why is that the two results are different.
Thnx in advace