Wednesday, 29 February 2012
J2EE: SERVLET: What is Servlet Interface?
Do you like this Article?
Interface javax.servlet.Servlet is that interface which defines the ServletLife Cycle methods. So, all servlets must implement this interface, either directly or by extending a class which implements this interface. Instead of directly implementing the Servlet Interface, a servlet can also extend Class GenericServlet (which implements Servlet Interface), or can extend HttpServlet Class (which extends the GenericServlet class).
Methods of Interface Servlet:
- init(ServletConfig config) : Called by the Web Container to initialize a servlet. Here,
config
is aServletConfig
object containing the servlet's configuration and initialization parameters
- service(ServletRequest req, ServletResponse res) : Called by the Web Container to allow a servlet to respond to a request. Here, req is the ServletRequest object that contains the client's request and res is the ServletResponse object that contains the servlet's response.
- destroy() : Called by the Web Container to clean up a servlet’s service.
- getServletConfig() : Return a ServletConfig object, which contain the initialization parameter and startup configuration of a servlet.
- getServletInfo() : Returns a string containing the details of a servlet, like author, version and copyright.
Subscribe to:
Post Comments
(
Atom
)
Popular Posts
-
public - public means everyone can access it.That means it's in global scope. As, main method is called by JVM [ Java Virtual Machine...
-
throw is used to throw an exception in a program, explicitly . Whereas, throws is included in the method's declaration part, wi...
-
Singleton in one of the most popular yet controversial design pattern, in the world of object oriented programming. It's one of t...
-
Web Container / Servlet Container / Servlet Engine : In J2EE Architecture , a web container (also known as servlet container or ser...
-
Program compiles. But at runtime throws an error “NoSuchMethodError”.
-
Vector : It's synchronized. It's slower than ArrayList. It's generally used in ...
-
doGet(): protected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, java.io.IOException – is a met...
-
In Java Programming Language , we must declare a variable name and type, before using it. The data type of a variable defines the th...
6 Responses to “ J2EE: SERVLET: What is Servlet Interface? ”
6 August 2015 at 10:38
b
6 June 2017 at 16:50
It is really a great work and the way in which u r sharing the knowledge is excellent.
Thanks for helping me to understand basic concepts.thank u so much for this nice blog .
java training in chennai |
java training institutes in chennai
13 October 2017 at 11:13
Really you have done a great job. Your post helped me a lot in the preparation of my technical interview.
Java Training in Chennai
Java Course in Chennai
Best Java Training in Chennai
23 April 2018 at 17:11
CIIT Noida provides Best MCA Courses in Noida based on the current
IT industry standards that help students to get high paying jobs in Top MNCs. CIIT provides Best MCA Training in Noida, Greater Noida, and Ghaziabad.
CIIT is one of the trusted MCA training institutes in Noida providing practical knowledge and 100% job assistance with basic as well as advanced
level MCA subjects. CIITN is the best MCA college in Noida, greater noida, ghaziabad, delhi, gurgaon regoin.
At CIIT MCA classes in Noida is conducted by subject experts corporate professionals with 9+ years of experience in managing real-time and live
projects. Sofracle Nano Specialized MCA classes Noida is the perfect blend of academic learning and practical sessions to provide maximum exposure to
students that transform an average student into a corporate professional whom companies prefer to hire.
Best MCA College in Noida
11 December 2018 at 16:48
Thank you for sharing article on servlet Interface...
Software Training courses in hyderabad | Java Training course in hyderabad
13 December 2018 at 20:10
Informative blog...
Wordpress website development workshop | Digital marketing course with internship
Post a Comment