Swings in three tier

Harpal Singh

Ranch Hand

Posts: 229

posted 15 years ago

Hi Guys, Long time since I have posted here. I was just wondering how to use Swings as my front end in three tier arch.. How do I present a swing screen to the user on Presentation tier and how does this talk to My middle tier like servlets, ejb etc.. Correct me if I am wrong One solution that comes to my mind is using Applet-Servlet communication and putting Swing in applets. or is there a way to embed my Swing code with JSP or Servlet and present it to user??? Seems a bit confusing ...Can some throw some light on it. Cheers, Harpal

Harpal Singh

Ranch Hand

Posts: 229

posted 15 years ago

Hi Guys, Nobody has a answer to it or is my question too weird to answer Did anyone ever wonder how Swing can be put in an n tier arch... else running Swing on a Stand alone PC is no big deal... Cheers, Harpal

I'm no expert in n-tier architecture... but other than making a JApplet - servlet connection ( not done a whole lot due to lack of Swing support in browsers), I would think that you would make a regular Swing GUI (JFrame) on a client and it would access whatever layer was behind the servlets. I thought the combination of applets and servlets ( web client ) was supposed to replace the functionality of a standalone GUI front-end?

I am not sure what are you asking... If you are asking if it can be done, well it can. If you are asking if it is a good idea, well it depends. We implemented a 6-7 tier system using swing at the front end. We use jnlp (webstart) to deploy to client machines. Middle tier is mostly EJBs but we also run some JSPs in the same app.

Harpal Singh

Ranch Hand

Posts: 229

posted 15 years ago

Hi Nate and Alex, Thanks a lot buddies ! But my doubt still persists... What I meant to ask was if I deploy my Application on MVC archi.... In the View if I put Swings and in my Controller if I use Servlets and Model is some database....How will (say if I am taking some data from user in swings forms and then sending to my Servlet for some Business logic) my Swing Application running on client side talk to my Servlet??

Else if that did not make much sense Alex as u said u have done many n tier archs with JSP and Swings just describe one of them in short like if u had Swings in presentation tier how did it talk to JSP or was it embedded in JSP ??? I hope I made some sense Cheers, Harpal

Alex Draper

Greenhorn

Posts: 8

posted 15 years ago

Well, we developed the client side as a Swing application (not an applet). Our middle tier consist of different layers, but to make things simple, lets just reference them as the EJB layer. Our EJBs run in Borland's AppServer. Now Back to the client side. Our client uses the HMVC arch. All the connections and calls to the middle tier are done inside the models. The controllers just handle the events generated by the views and the creation of other child triads in the view. (A triad consist of a view, model, and its controller). Our views implement the Obersver interface, and our models extend the Observable class, to synchronize the views with its models. We moved the intensive data gathering to jsps. The app. sends a cmd to the OS, which brings the default browser up and calls the jsp. Our JSPs are handled by TomCat which comes with AppServer. JavaWorld has an article on HMVC. You can also look at scoope Here is a link to scoope, which is an open source HMVC arch. http://scope.sourceforge.net/

Harpal Singh

Ranch Hand

Posts: 229

posted 15 years ago

Thanks a lot Alex That makes things clear... A very Happy New Year to you... Cheers, Harpal