Ankur
Ankur

Reputation: 51100

How to debug a servlet in eclipse without having to deploy it

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.

Upvotes: 0

Views: 1368

Answers (2)

Thilo
Thilo

Reputation: 262534

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.

Upvotes: 1

user7094
user7094

Reputation:

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.

Upvotes: 1

Related Questions