• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

servlet init parameters for jsp

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you are right i was calling with jsp name,i changed to servlet name it worked !

thank you man
 
Hug your destiny! And hug this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic