• 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

which class is implementing the RequestDispatcher interface

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai
please tell me which class is implementing the RequestDispatcher interface
interface RequestDispatcher
{
----
}
class ?? implements RequestDispatcher
{
-------
}

2.Q) the service() method is compulsory required ServletException and IOException

ex: public void service(HttpServletRequest request,HttpServletResponse response) throws IOException

while writing the above service() method i am able to run the servlet program. I am getting the output with out writing the ServletException.

please clear me.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These are basic Java questions, not so much Servlet questions.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1.) The container you are using will pass you an instance of RequestDispatcher when you call either
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)
or
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletRequest.html#getRequestDispatcher(java.lang.String)

You don't really need to concern yourself with the actual class. You nust need to know that it implements RequestDispatcher.
If you're curious about the class name and you want to see it, the following code, will print it to stdout.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
2.) As David mentioned, exception handling and inheritance are not servlet specific questions. I'll let someone else answer that but....

It is worth mentioning that overriding the service method in a servlet is not a good practice. Rather, you should override the methods for the specific request type that you want your servlet to handle. This usually means doGet and/or doPost.
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic