Can Swing be used in web-based application?

Hi,

I have a swing destop application, where I have arranged the swing components using JPanel, JFrames... Is it possible to use the same JPanel items in the web application? This is to reuse the screens in web application which was actually created for Desktop application.

I would be grateful if I get any pointers to reuse the JPanel items in the web which was created for desktop application.

..Thiruppathy.R

[437 byte] By [Thiruppathy.Ra] at [2007-11-27 5:17:51]
# 1

That depends. You can convert your application to run as an applet, possibly fairly easily. Then it'd be embedded in a web page, and could connect to the server via HTTP or some other way.

But that's not a true "web application", as it's come to mean. In which case the answer is no. You could probably reuse parts on a server side within JSP or J2EE, but the Swing code would not be part of the presentation.

bsampieria at 2007-7-12 10:40:48 > top of Java-index,Desktop,Core GUI APIs...
# 2

Thanks for your reply.

So, the only way to use the existing swing components, is to put them into the JApplet container and include the applet with the html page. Could you correct me if I am wrong.

>>>You could probably reuse parts on a server side within JSP or J2EE, but the Swing code would not be part of the presentation.

Does it mean that we can reuse only the second level (next tier) of service which serves the data information and manipulation, but not the UI controls and events parts?

..Thiruppathy.R

Thiruppathy.Ra at 2007-7-12 10:40:48 > top of Java-index,Desktop,Core GUI APIs...
# 3

> So, the only way to use the existing swing

> components, is to put them into the JApplet container

> and include the applet with the html page. Could you

> correct me if I am wrong.

Correct. Usually "web application" is just HTML based accessed via a web/application server. The Swing components need something to live in on the user's side.

> >>>You could probably reuse parts on a server side

> within JSP or J2EE, but the Swing code would not be

> part of the presentation.

>

> Does it mean that we can reuse only the second level

> (next tier) of service which serves the data

> information and manipulation, but not the UI controls

> and events parts?

Correct. Running the swing UI on the server side would only show on the server, not the client side. Unless you do the applet route.

bsampieria at 2007-7-12 10:40:48 > top of Java-index,Desktop,Core GUI APIs...
# 4
Have you looked into Java Web Start? http://java.sun.com/products/javawebstart/1.2/docs/developersguide.html
KelVarnsona at 2007-7-12 10:40:48 > top of Java-index,Desktop,Core GUI APIs...
# 5
Of course, WebStart is kinda a cross between applet and application, launched (at least initially) via a web page link.If your desktop application already just only talks to a server, then using it as an applet or with WebStart would be a fairly simple conversion.
bsampieria at 2007-7-12 10:40:48 > top of Java-index,Desktop,Core GUI APIs...
# 6
That looks good.I did not have a look at 'Java[tm] Web Start Developer's Guide'. Let me see whether it helps me which may be fairly simple conversion as u said.Thanks a lot for your guidance.
Thiruppathy.Ra at 2007-7-12 10:40:48 > top of Java-index,Desktop,Core GUI APIs...