GeeCON Prague 2014*
The moose likes Servlets and the fly likes debugging a javabean called by jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "debugging a javabean called by jsp" Watch "debugging a javabean called by jsp" New topic
Author

debugging a javabean called by jsp

mike mckenna
Greenhorn

Joined: Sep 26, 2000
Posts: 6
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

Joined: May 16, 2001
Posts: 15
Have you tried just putting in some System.out.println() in your bean?
mike mckenna
Greenhorn

Joined: Sep 26, 2000
Posts: 6
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

Joined: Jun 19, 2001
Posts: 9
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

Joined: Sep 26, 2000
Posts: 6
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
 
GeeCON Prague 2014
 
subject: debugging a javabean called by jsp