This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes config implicit object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "config implicit object" Watch "config implicit object" New topic
Author

config implicit object

subathra sangameswaran
Greenhorn

Joined: Nov 19, 2005
Posts: 27
Hallo Everyone,
I am trying to learn jsp.
why does not this scriptlet in my form.jsp work?
<%= config.getInitParameter("email") %>
My web.xml has the following

<servlet>
<servlet-name>MyJSPServlet</servlet-name>
<jsp-file>/form.jsp</jsp-file>
<init-param>
<param-name>email</param-name>
<param-value>subansuba@yahoo.co.in</param-value>
</init-param>
</servlet>

I simply get
My Contact: null
when i get to this page

Thanks and regards


suba
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Are you hitting the JSP directly?
If so, init params won't show up.
You'll need to create a servlet mapping and point your browser to the url-pattern from your mapping.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
subathra sangameswaran
Greenhorn

Joined: Nov 19, 2005
Posts: 27
Thanks. I works. I am just a beginner. Sorry for making too silly questions...
This topic may be closed
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It wasn't a silly question.
There is no need to close the thread.
It will sink into the abyss as newer ones show up and push it down.
Glad it's working and Welcome to Javaranch.
 
 
subject: config implicit object