• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
gopal kishan
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic