Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

implicit object config cannot get the init parameter and servlet name.  RSS feed

 
Ranch Hand
Posts: 1691
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my web.xml:


<servlet>
<servlet-name>HelloWorldServlet</servlet-name>
<servlet-class>murach.email.HelloWorldServlet</servlet-class>
<init-param>
<param-name>counter</param-name>
<param-value>1</param-value>
</init-param>

</servlet>




In my.jsp:


However, my output on the browser is :
Servlet config param using scriptlet: null
Serlvet name using scriplet : jsp
(I don't know why the name is not helloWorldServlet.)

But the output from the HelloWorldServlet is:
the servlet context param is : 1
serlvet name: HelloWorldServlet

The config implicit object does not return the correct data from the servlet.

Thanks in advance.
 
Himai Minh
Ranch Hand
Posts: 1691
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found out this:
I don't need to have a servlet class


<servlet>
<servlet-name>TestConfigServlet</servlet-name>
<jsp-file>/my.jsp</jsp-file>
<init-param>
<param-name>counter</param-name>
<param-value>1</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>TestConfigServlet</servlet-name>
<url-pattern>/my</url-pattern>
</servlet-mapping>





Then, I got the counter = 1 printed and the servlet name is TestConfigServlet.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!