• 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

about GenericServlet

 
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why GenericServlet is implements ServletConfig
I think at init(ServletConfig) method is received ServletConfig
Is it make sense??
Thank
 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The configuration parameters initialised by the init(servletConfig) method, but how does the implement servlet classes get handle to the configuration parameters initialized from the init() method. Hence the Generic servlet extends ServletConfig interface
 
Weerawit Maneepongsawat
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think all servlet had hold ServletConfig by use
getSerlvetConfig() method.
Can this code true
ServletConfig config = (ServletConfig) this;
???
Is it make sense??..
thank for reply..
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ServletConfig object is initialized by the container and passed to the servlet so that the servlet can know something about the initial input parameters.
I believe the only reason GenericServlet implements ServletConfig interface is to make an simple API for the developer to access the init parameters and ServletContext. Please notice that there is a method getServletConfig() defined in GenericServlet. After calling that, you can get hold of a ServletConfig object. From there, you can get all init information by calling the 4 methods defined in ServletConfig interface: getInitParameter(String), getInitParameterNames(), getServletContext(), getServletName(). These 4 methods are exposed to developer in GenericServlet API so that the developer can call them directly instead of going through the route of getting a ServletConfig object first.
That is just my understanding. Does this make sense to you guys?
Tieyi
 
This is my favorite tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic