• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generic Servlet vs HttpServlet

 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Could someone please clarify:

If I use a Generic Servlet,the ServletConfig is automatically available to me through getServletConfig().
If I use an HttpServlet,I will need to store the ServletConfig in the init method before I can call ServletConfig.
I can access a Generic Servlet's ServletContext by calling getServletContext()
But to access an HttpServlet's ServletContext I need to call getServletConfig().getServletContext()..(after manually storing the servletConfig in the httpServlet's init method)

True/False???
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HttpServlet extends GenericServlet, so whatever methods you can use in the latter, you can use in the former.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh....ok thanks.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could anyone give me an example of:

A component processed late in the request cycle that needs to send an error status code when the response has already been commited?
From SCWCD study companion,pg102

Thanks...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic