CS651 | Web Systems
  • outline
  • projects
  • syllabus
  • links
   Debugging a Servlet




The Problem

  • Unlike Applications and Applets, can be more challenging to debug as they are run remotely on a server....so you do not have a console window to print errors to directly and watch the progress. 

Possibilities:

1) Have a Development local machine where you CAN use a debugger and set breakpoints.

2) View the HTML source returned by the browser.  You may have missing tag that is causing the browser to choke.

3) Write messages to the log file.  The HttpServlet class has a method called log, you can uses this to write information to a log file.  

  • Location of  log file is server-specific, see documentaiton for your serverl.


4) Write messages to your own file on the server.

5) Return error page to client

  • return via generated web-page, any error messages.
  • Alternatively, use sendError() method of HttpServletResponse class (in your doXXX methods)
     

cs651:web systems

  • home
  • outline
  • projects
  • syllabus
  • links