• 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

My servlet Notes

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have prepared the below notes covering the basic ways a servlet can get information from outside world, kindly request you to validate whether my understanding is right
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Narain,

Just some remarks on your short summary (please check the API for the parameters and return types)

request.getParameter() - For HTML form elements(including cookies)


getting cookies is done by calling request.getCookies()

request.getAttribute() - For requests forwarded via RequestDispatcher


For objects stored in the request (those are probably set by calling request.setAttribute() before calling the RequestDispatcher)

ServletConfig.getInitParameter() - For paramers defined using <init-param> in DD


Be careful here, this are the init parameters for the Servlet defined inside the <servlet> element, you also have init parameters for the whole web-application (ServletContext) defined in the <context-param> element of the DD

ServletContext.getAttribute() - For Objects stored in ServletContext(Shared b/w mutiple request for same servlet)


These objects are shared through the whole web-application, so for all the servlets defined in de DD!

Regards,
Frits
 
reply
    Bookmark Topic Watch Topic
  • New Topic