• 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
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

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
 
Just the other day, I was thinking ... about this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic