Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

servlet initialization in JSP

 
Sreedhar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to implement the servlet initialization in JSP, example given in HFSJ book, page no. 308.

--------------------------------------------------
in DD:

<servlet>
<servlet-name>Ex1</servlet-name>
<jsp-file>/Ex1.jsp</jsp-file>
<init-param>
<param-name>email</param-name>
<param-value>sreedharp@ins.com</param-value>
</init-param>
</servlet>


in JSP :
<%
String email = config.getInitParameter("email");


%>
<%="email ---> " + email %>

-------------------------------------------

But this not seem to work. The output is null.
Any reasons for this.
 
Priya Jothi
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did u also configure servlet mappings appropriately?.
 
Sreedhar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it. I did not do the mapping of the servlet.

Thanks.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!