File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

debugging a javabean called by jsp

 
mike mckenna
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need a way to debug a java bean when used by a jsp. I tried running the bean with a stand alone main() method and everything works fine. However, when I call a jsp that references a method in the bean, I'm getting null objects returned.
To debug the bean, I tried passing the jsp's ServletContext object to my bean and then calling the ServletContext.log method from within the bean. This does not produce any output in the webservers error log. This is a handy way to debug a jsp though.
Finally, I tried creating a method in the bean that writes a message to a file. I can call this bean method from the jsp and it writes my message to the file. I then tried creating an instance of the bean within the another bean method that the jsp calls. In this other method that the jsp calls, I tried calling my method that writes to the file. Again, no output was produced.
Hope this makes sense!
 
Ted Dong
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried just putting in some System.out.println() in your bean?
 
mike mckenna
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.out.println was the first thing I tried. I can't figure out where the output is going from the webserver. I'm running IPlanet (can't tell what version) on an NT server. Thanks
 
parind poi
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The System.out.println typically goes out to the window in which you started the server. If you started it as a background server and killed the window, then you won't be able to see the contents. Try restarting the IPlanet server in a new window and check its contents.
 
mike mckenna
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As usual, the error had to do with something else. I wasn't initializing the bean correctly from the jsp. Once this was corrected, both of my methods for logging started working. Consider this issue closed. Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic