Is it possible to display a JTree populated from a database in a servlet? If so can someone give me an example...I am very new to Java and JDBC.
thanks,
-G.
You can do it but it's a non-trivial exercise in that the servlet has to stream the result set out to the JTree. An alternative would be to use dynamically written Applet Parameters to hold the result set.
I have already tried coding in an applet...it works fine on its own but when I try to access it from a webserver it does show the elements of the tree, the reason being....
Applet cannot connect to the database server (on the same machine as my webserver).
I also tried making a databaseHandler on the webserver that communicates with the da server ans returns the result to the client ...but the applet class somehow does not get the databaseHandler class ...
I have already done the coding for the servlet except that I haven't been able to display the tree in the servelet..Is there any way I can display a swing component in a servlet?
-G.
No, there is no UI in a servlet. Although I haven't done it personally, I know for a fact that the data can be collected on the server side and streamed to an applet on a browser for use by a tree widget because a co-worker did just that for a "bill of materials" type of application. I belive the design actually instantiated the model to be used by the tree on the server then sent the serialized objects out to the applet. I don't do fat client Java so I'm afraid I can't help much beyond the concepts.
Bookmarks