• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

doubt in servlet execution.............

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class ServletExcep extends HttpServlet
{
public void service(HttpServletRequest req,
HttpServletResponse res)throws ServletException,
IOException
{
res.setContentType("text/html");
PrintWriter out= res.getWriter();
out.println("TEST MESSAGE----");
try
{
int
statusCode=Integer.parseInt(req.getParameter("statusCode"));
out.println("statuscode--"+statusCode);
}
catch(Exception e)
{
res.sendError(500, " SORRY WRONG VALUE PASSED");
}

}
}

Here , if i run the file i am getting error
" HELP/NAVIGATION ERROR - File Not Found
Unable to find http://localhost:8090/examples/servlet/ServletExcep "

if i make comment from try block to catch block, the it shows message " TEST MESSAGE----- ".

i dont know whats wrong??/

please clarify..

thanks in advance
Gopal
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Check your servlet mapping in the web.xml. Include package statement in the first line of your servlet code. Recent tomcat version does not recognise the servlets without package.
bye for now
sat
reply
    Bookmark Topic Watch Topic
  • New Topic