views:

233

answers:

2

This is not a programming question but is only relevant to programmers, so I think it is appropriate.

How do you go about debugging a program a servlet in Eclipse. Can I somehow use my JSP's to create "simulated" request objects and have the servlets try to handle them, from Eclipse with our without some plugin. This would be ideal if I could then step through the code and see where I am getting my errors.

+1  A: 

Install the Eclipse Web Tools Platform.

And even without WTP the normal Eclipse Java debugger can attach to a remote process, so you can debug (set breakpoints and step through) your regular servlet container.

Thilo
FWIW: the "Eclipse for Java EE" is the IDE you really need for JSP/Servlet (Java EE) development. It comes by default with under each the great WTP.
BalusC
+1  A: 

You can create mock HttpServletRequest and HttpServletResponse objects. It should be possible for you to execute a servlet's main method from a unit test the like, which can then be attached to Eclipse's normal debugger.

Phill Sacre