• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
 
I found a beautiful pie. And a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic