javascript
Brief description  about Online courses   join in Online courses
View Vasudha  Hegde 's Profile

HttpServlet

Difference between HttpServlet and GenericServlet?
Asked by Vasudha Hegde | Jul 19, 2010 |  Reply now
Replies (3)
View java teacher 's Profile
javax.servlet.GenericServlet
Signature: public abstract class GenericServlet extends java.lang.Object implements Servlet, ServletConfig, java.io.Serializable

* GenericServlet defines a generic, protocol-independent servlet.
* GenericServlet gives a blueprint and makes writing servlet easier.
* GenericServlet provides simple versions of the lifecycle methods init and destroy and of the methods in the ServletConfig interface.
* GenericServlet implements the log method, declared in the ServletContext interface.
* To write a generic servlet, it is sufficient to override the abstract service method.

javax.servlet.http.HttpServlet
Signature: public abstract class HttpServlet extends GenericServlet implements java.io.Serializable

* HttpServlet defines a HTTP protocol specific servlet.
* HttpServlet gives a blueprint for Http servlet and makes writing them easier.
* HttpServlet extends the GenericServlet and hence inherits the properties GenericServlet.
Dec 24, 2010
View ravi shankar 's Profile
GenericServlet is an abstract class which is protocol independent mean we can use GenericServlet to handle HTTP requests,ftp requestes etc.. HttpServlet is protocol specific it is intended to handle HTTPRequests only.
Jul 25, 2010
View sunil kumar mondal 's Profile
TEST1.jsp

<html>
<Body>
Befor InClusion

Enter Your Name
<Input Type="TextBox" Name="User"
Value="Prakash"/>
<%
<Jsp:include page="TEST2.jsp"/>
%>

After Inclusion
</Body>
</Html>

TEST2.jsp
<html>
<Body>
<%
String user=request.getParameter("User");
out.println("Welcome To Java"+user);

%>
</Body>
</html>


Is This Answer Correct ? 1 Yes 0 No
Jul 19, 2010