| Author |
Servlets to Swing
|
Mohan Panigrahi
Ranch Hand
Joined: Sep 28, 2001
Posts: 142
|
|
Hi, I have a small Servlets application, with three pages. It stores and displayes data from xml files. This requires some application server to run. Now I wish to transfer it to swing, so that I can distribute it to my friends. My requirement is that I should be able to retain the HTML look as I have already developed for the servlets application. Any suggestions or some code snippets on how to go about it, would be helpful. Thanks Mohan
|
 |
Chantal Ackermann
Ranch Hand
Joined: Sep 28, 2000
Posts: 508
|
|
hi, if you have a html/web application up and running - why would you want a swing application? however, a swing client can connect to a servlet. so you shouldn't have to implement some new backend. here is some sample code for calling a method from the client on the servlet: regards, Chantal
|
 |
Mohan Panigrahi
Ranch Hand
Joined: Sep 28, 2001
Posts: 142
|
|
Thanks for the reply. To clarify : I want to port it to swing, because I want to distribute it without having to host the application in some app server. All suggestions welcome!
|
 |
Chantal Ackermann
Ranch Hand
Joined: Sep 28, 2000
Posts: 508
|
|
|
what is your servlet doing actually? won't you need it for the swing client?
|
 |
Mohan Panigrahi
Ranch Hand
Joined: Sep 28, 2001
Posts: 142
|
|
Ok! My servlet throws a page which shows all the tasks a person has to do. He has button to add more tasks or remove the already present tasks. The html page has colorful buttons, style sheets etc. What I want to do is to give the user, an installable by which he can the program run on his own machine. But I still need to retain the looks of html. I hope you would understand my requirements
|
 |
Younes Essouabni
Ranch Hand
Joined: Jan 13, 2002
Posts: 479
|
|
In fact you may create a JTextArea that will behave just like a web browser. I think that's what you need, but don't ask me how to do it I hope it helps
|
Younes
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
|
 |
Chantal Ackermann
Ranch Hand
Joined: Sep 28, 2000
Posts: 508
|
|
a JTextArea can't behave like a Browser. a JEditorPane can render html, but it cannot replace a browser (there are commercial java browser components, though). I think, you should write the swing client first, with all the behaviour that has the browser application. that is still some task to do. afterwards you can think about the look and feel of the client. With the pluggable LookAndFeel of swing it is no problem to change the appearance of your application according to some config settings. how to create a LookAndFeel, or how to implement at least a Theme, see the source code of the classes in javax.swing.plaf.metal.*. sun has published a detailed tutorial on LookAndFeel on the net. chantal
|
 |
 |
|
|
subject: Servlets to Swing
|
|
|