This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes why this error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "why this error" Watch "why this error" New topic

why this error

Arun Maalik
Ranch Hand

Joined: Oct 25, 2005
Posts: 216
import javax.servlet.*;
import javax.servlet.http.*;

public class first extends HttpServlet{

public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException{
PrintWriter out=res.getWriter();
out.println("This is my first servlet");

Dear sir in the above code if i will not extend the class first from that of HttpServlet and then when i am deploying then i m getting an error message that Noservlet class was added in the war module why sir why? although i am using J2EE server.

with regard

Arun kumar maalik
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
You don't need to extend HttpServlet, but you do need to implement Servlet, so that the servlet lifecycle methods are available to be used by the container. But why wouldn't you want to extend HttpServlet - it does a number of useful things that you would have to program yourself otherwise (e.g., the dispatching to the doXYZ methods).
Eddy Lee Sin Ti
Ranch Hand

Joined: Oct 06, 2005
Posts: 135
Which J2EE server you are using? Maybe you can post your web.xml here for further analysis

SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="" target="_blank" rel="nofollow"></a>
gopinathang nathan
Ranch Hand

Joined: Oct 28, 2006
Posts: 41
For me it seems to be, 'I need only accelerator, brake, steering and gear. i dont want anyother things for my car, apart from these'
I agree. Here's the link:
subject: why this error
It's not a secret anymore!