I have the servlet name ExampleServlet.java which have only init method with HttpServletRequest and HttpServletResponse parameters. I will forward the request to another servlet named ForwardedServlet.java which will display some text on the web page. But when i am trying to execute the ExampleServlet http://localhost:8080/Sample/ExampleServlet the following error occurs.
Please give the solution and why it this error occured... Thanks in advance
You haven't implemented the 'doGet' method, so it's falling back to the default implementation, which is a 503 server error (or some variant).
The init is only called once, when the servlet is instantiated - it's not called once per request, which you'll need to do.
Also, make sure the capitalisation and arguments are correct; if you use something else, it won't be the right method that the Servlet API calls.