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

getting init parameter values in jsp page  RSS feed

 
Muthumuthu Kumaran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi to all,,
i have set a initparameter in web.xml....
But i cant access those values in jsp file...

My web.wml content

<servlet>
<servlet-name>Muthu</servlet-name>
<jsp-file>jsp/MyJsp1.jsp</jsp-file>
<init-param>
<param-name>user</param-name>
<param-value>MuthuKumaran</param-value>
</init-param>
</servlet>

My Jsp Content

<%out.println( getServletConfig().getInitParameter("user"));%>
<%=config.getInitParameter("user")%>

I HAVE GOT OUT PUT AS "NULL"
[ October 29, 2006: Message edited by: Muthumuthu Kumaran ]
 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Accessing the jsp/MyJsp1.jsp by using the url pattern that you have given in web.xml or directly jsp/MyJsp1.jsp ?

You cant get the init parameter value, if you are accessing by using jsp/MyJsp1.jsp.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!