• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet debugging

 
Neo Wills
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am running tomcat6. A request is sent from the javascript client end to the servlet through the get method. But I dont see the servlet code getting executed. Is there a way to debug this piece of communication?

I dont see any errors in the tomcat logs either.

Bharath
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you use eclipse simply add a breakpoint. If you don't, add some System outs in the method body, or simply use eclipse
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64830
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sebastian Janisch wrote:System outs ...

System outs? Dude! Log4J!

Install Firebug in Firefox so you can see the Ajax request in action. You can also install HttpFox to see all of the requests and responses.
 
Neo Wills
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Looks like the get request is not issued at all (atleast thats what the httpfox is hinting as I dont see any requests in it).

If I execute my servlet directly from my browser say like: http://localhost:8080/abc/cde/HelloWorldExample it works.

The java script is present outside the WEB-INF directory inside abc. And I pass the URL as /cde/HelloWorldExample. Is there anything wrong in this?

This is the code in js:



And my servlet code, just prints Hello world on my screen:


I expect to see the Helloworld on the click (which invokes the open and send calls). But that doesnt happen. The files on the dir structure are :

ABC
----- index.html, index.js
----- WEB-INF
--------- web.xml
--------- CLASSES
--------------- CDE (package for the class)
--------------- HelloWorldExample.class

Should I create a jar file and package them together (is that what is missing)?

Bharath
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Sebastian Janisch wrote:System outs ...

System outs? Dude! Log4J!

Install Firebug in Firefox so you can see the Ajax request in action. You can also install HttpFox to see all of the requests and responses.


What do I know how to debug on the server side if you don't use Eclipse. I know it's retarded :-D.
 
Neo Wills
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot folks. My bad with the get request. The request was not sent on ajax due to some bad return value. Httpfox really helped with this .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic