aspose file tools*
The moose likes Servlets and the fly likes doubt in servlet execution............. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "doubt in servlet execution............." Watch "doubt in servlet execution............." New topic
Author

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

gopal kishan
Ranch Hand

Joined: Feb 23, 2005
Posts: 99
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

Joined: May 03, 2004
Posts: 334
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
 
subject: doubt in servlet execution.............