Meaningless Drivel is fun!
The moose likes Servlets and the fly likes servlets with swings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlets with swings" Watch "servlets with swings" New topic

servlets with swings

trinadh reddy
Ranch Hand

Joined: Sep 22, 2005
Posts: 60
can we write swing applications in servlets
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
Yes, it's possible. Do not forget to use option headless if servlet runs on Unix boxes.

Tough in space?, <a href="" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="" target="_blank" rel="nofollow">Check it here.</a><br /><a href="" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
trinadh reddy
Ranch Hand

Joined: Sep 22, 2005
Posts: 60
where can i find sample code to include swing applications in servlets
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by trinadh reddy:
can we write swing applications in servlets

I would say, No.
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Why do you want a GUI component that runs on the server?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

I'm agreeing. The answer 'Yes' may have been misleading.

You can indeed use the AWT and Swing classes in a web application, the 'headless' option is in case the server is installed without a graphical interface. If this is the case the OS support required by AWT will not be available.

You cannot, however, use AWT or Swing classes in web aapps and send them to the client. To do this you would need to write an Applet.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

You could also write an application that uses applets (with or without Swing) that interact with servlets.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Andreas Ecker

Joined: Jun 13, 2002
Posts: 4

using Google I found a link for using Swing in servlets:

Here it's used to create pictures to be sent to the client.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

The 'yes' answer was very misleading. While you can use just about any Java technology with Servlets, it doesn't always make sense to do so. I guess we'll have to wait for the OP to clarify what it is he is actually trying to accomplish.

[Asking smart questions] [About Bear] [Books by Bear]
Eddy Lee Sin Ti
Ranch Hand

Joined: Oct 06, 2005
Posts: 135
can we write swing applications in servlets

The example of "swing application" above are merely reuse of particular swing related functionalities, not complete enough to consider as a swing application.

You can write a servlet to invoke a swing application to run in server side, but i doubt practically anyone would do that for enterprise applications.

SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: servlets with swings
It's not a secret anymore!