• 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

HttpServlet API

 
Ranch Hand
Posts: 338
Scala Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pankaj,
Your servlet container provides an implementation. For example, Tomcat.
 
Pankaj Shet
Ranch Hand
Posts: 338
Scala Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic