• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpServlet API

 
Pankaj Shet
Ranch Hand
Posts: 300
Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,
I am having 1 doubt regarding servlets and jsp.
the doubt is about the Interfaces in Servlet API and HttpServlet API.

suppose if I am having an HTML form having 2 fields, Username and Password.

I will capture those values in the servlet using

String Username = request.getParameter("Username")
and Password using
String password = request.getParameter("Password")

as we know, request is HttpServletRequest which is an Interface and since it is an interface, all the methods are unimplemented abstract methods, am I right?

and those methods need to be implemented somewhere in some classes?
can anyone help me to find the implementation of those methods?
and if implementation is not provided, how those methods provide the desired functionality?

and if the container provides the implementation, how does it do that? Which class inside the container provide the implementation of those interfaces?

Please help me out for this problem.

Help is always appreciated,

Thanks and Regards,
-Pankaj



 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pankaj,
Your servlet container provides an implementation. For example, Tomcat.
 
Pankaj Shet
Ranch Hand
Posts: 300
Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh thanks a lot for such a prompt reply, jeane , but can you tell me which classes or which jar file inside tomcat provide those implementations?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The nice thing about an interface is that I don't need to know that. If I wanted to find out I would call request.getClass() or set a breakpoint and check which implementation was provided.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic