I'm really new to jsp/servlets, so I might be missing something completely obvious. I apologize for the length. Let me first describe what I'm trying to do.
1. I want a jsp page that contains a number of dynamic list boxes 2. I want these list boxes as paramaters of a java bean by this I mean <jsp:getProperty name='beanName' property = 'member_List'/> should return a string that corresponds to a list with all of the correct values 3. The getProperty methods at the bean should connect to the database, pull all values out of a table, and format the results as a string conforming to the html list requirments
My problem is that nothing is showing up. The string does not get passed from the bean to the jsp. I'm not sure what the problem is. If anybody could suggest a good way to debug this I'd be most appreciative (Tomcat on Windows 2000). What's wierd is that I wrote a tester class with this main method:
public static void main(String[] args) { ListBoxBean test = new ListBoxBean(); System.out.println(test.getMember_List()); }
and it prints out the list exactly as it should be formatted.
Am I missing something completely obvious?
A couple of other questions:
1. How can I share the connection within the bean? 2. How can I close the connection when done?
Any help would be greatly appreciated, I'm tearing what little hair I have left out.
Any text directed to the string output before this command is reflected in the html page returned, anything after this within the try-catch block is not. So it's generating an exception. The question, then, is why? An exception isn't thrown when the tester program calls the method, why is one thrown when called from jsp?
Exception is not necessarily thrown for all "issues". Make sure connection != null. If it is, we have got some other problem. Also check if the driver is available to Tomcat in the classpath. If you would, post the stack trace - we can analyze that.