Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp init parameters

 
Sharma Anjali
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to retreive init paramters in my jsp.
Here's the DD

<servlet>
<servlet-name>T</servlet-name>
<jsp-file>/A.jsp</jsp-file>
<init-param>
<param-name>email</param-name>
<param-value>abc@zyz.com</param-value>
</init-param>
</servlet>


and this is in the jsp page

<%= config.getInitParameter("email") %>

But this returns null.
Plz tell me where am I doing it wrong?
 
srinath anand
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anjali,
You need this in your web.xml also:

<servlet-mapping>
<servlet-name>T</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic