www.webdeveloper.com
Results 1 to 6 of 6

Thread: Jtree in a servlet?

  1. #1
    Join Date
    Nov 2004
    Posts
    19

    Question Jtree in a servlet?

    HI ,

    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.

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,123
    I have not doen this but you should be able to display it in an applet(Servlet just shows html)
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  3. #3
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    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.

  4. #4
    Join Date
    Nov 2004
    Posts
    19

    Re: Jtree in a servlet?

    HI,

    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.

  5. #5
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    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.

  6. #6
    Join Date
    Nov 2004
    Posts
    27
    You can visit the below site:
    http://www.wi-bw.tfh-wildau.de/DOKU/...torialTOC.html
    which has information about Java Servlet Technology.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles