aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes My servlet Notes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "My servlet Notes" Watch "My servlet Notes" New topic
Author

My servlet Notes

narain ashwin
Ranch Hand

Joined: Dec 27, 2007
Posts: 48
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


I drink two cappuccinos a day.Is that of any help to solve java problems??
JBoss 6 - Admin console Username/pwd: admin/admin
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1717
    
  25

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: My servlet Notes