• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

servlet debugging

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic