This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet init parameters for jsp

 
sundar katluri
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying set servlet init parameters for jsp
like...


where my jsp name is hobbypage.jsp
when i am trying to execute this code

<%@ page import="java.util.*" %>
<%! public void jspInit(){

ServletConfig c = getServletConfig();
String s = c.getInitParameter("adminEmail");
System.out.println(s);

}
%>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>

<BODY>
<h3>hello testing jsp init parameters</h3>
<br>


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

</BODY>
</HTML>


then its priting null at server output and in the generated html
what's wrong with the code? am i doing wrong?
 
sundar katluri
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i forgot to tell my environment
Tomcat 5.5.4
JDK 1.5.0

I duplicated my jsp code sorry about that
Any help greatly appreciated
 
Zhing Lam
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you invoke you JSP? I suspect you invoke it directly(using something like http://localhost:8080/hobbypage.jsp), if that was the case, you should invoke it using the servlet name.
 
sundar katluri
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are right i was calling with jsp name,i changed to servlet name it worked !

thank you man
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic