This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes Problem to integrate Struts with Swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem to integrate Struts with Swing" Watch "Problem to integrate Struts with Swing" New topic
Author

Problem to integrate Struts with Swing

bhuvana mounagurusamy
Greenhorn

Joined: Sep 21, 2006
Posts: 5
Hi ..

I am having one Swing Application.. I would like to integrate this one to Struts.. How to call Swing application when i click the struts html button ..

Please Help me in this..

Thanks,
Bhuvana
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
There's no good way to integrate a Swing application and a Struts application. A Swing application is either a Stand-alone application or a fat client application, while a Struts application is a web application, and the two don't mix.

If you wrote your Swing application with MVC principles in mind, your model classes will have been written without dependencies on Swing. In that case, you can take these model classes and plug them in as the model to your Struts application. If you didn't keep this separation, you will pretty much have to rewrite the application.

One other alternative is to turn your Swing application into an applet. That can be done quite easily, and it will run on a browser. However, by doing this, you incur the problems associated with applets, such as long download times and security issues.


Merrill
Consultant, Sima Solutions
bhuvana mounagurusamy
Greenhorn

Joined: Sep 21, 2006
Posts: 5
Thanks for your suggestion...

I will try with Applet insted of Swing..

-Bhuvana
bhuvana mounagurusamy
Greenhorn

Joined: Sep 21, 2006
Posts: 5
Hi ..

I have a jsp which contains an applet...

The Applet contains one Button Which perform some action.. This Action Works fine independetly.. I am unable to perform that action into my JSP page..

How can i accomplish this ..

Thanks for your attention!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
There is a netscape.javascript.JSObject class that will allow an Applet to interact with JavaScript on an HTML page. Once you have this link to JavaScript you can submit a form or perform any other action normally performed in an HTML document from within your Applet code. I haven't used it, so I'm not that familiar with how it works, but this link should get you started.

Be careful, though. As I see it, you need to decide if this is going to be an Applet application that runs entirely within the Applet framework, or if it's going to be a web application with some added applet features. If it's going to be an Applet application, the interaction between HTML and the Applet should be minimal. If it's going to be a web application, page navigation, etc. should be handled by Struts, and the applet should only provide a few features. If you try to mix and match between the two worlds too much, you could have a real mess on your hands.
[ October 04, 2006: Message edited by: Merrill Higginson ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem to integrate Struts with Swing