Can I use Swing in a J2EE project?
Hi everyone!
I am new to Swing, and I would like to know, if is possible create a application using Swing as view tier in a J2EE(EJB) project? Did anybody create one yet? How many J2EE projects do you know which Swing is used as view tier? Using Swing is so much more complicate than a ordinary output in HTML? Is there a open source project uses this approach? I don't want to use M$ Visual Basic anymore! Please, help me!
Regards
> I am new to Swing, and I would like to know, if is
> possible create a application using Swing as view tier
> in a J2EE(EJB) project?
Yes, it is entirely possible, they are usually called Rich Clients (as in functionality) and may or may not use RMI/EJB. They typically also include the Controller (from MVC pattern) in the Client. The EJB represent the model, remember that the MVC is a Client Server Pattern, not an J2EE pattern.
> Did anybody create one yet?
Yes, the idea is not uncommon, you can read a more here:
http://www.google.co.uk/search?hl=en&ie=ISO-8859-1&q=Rich+Swing+Java+Client&btnG=Google+Search&meta=
> How many J2EE projects do you know which Swing is used
> as view tier? Using Swing is so much more complicate
> than a ordinary output in HTML?
No, just different. Instead of doing each action in your Swing App, use the normal EJB method.
> Is there a open source project uses this approach?
Probably, checkout the list of Google links above.
Here is a sun tutorial, that introduces the principals.
http://java.sun.com/features/2002/03/whatdev.html
> I don't want to use M$
> Visual Basic anymore! Please, help me!
Good for you :-)
You can use Swing to develop rich GUI,(as with VB), this part is the Client Layer.
For the Middletier Layer, you have the choices:
*use the servlet API, to produce XML data (or even raw data in binary mime type) for each HTTP request from your swing client (the GUI uses java.net.URL class ...)
a enhanced solution will be to use WebServices so the underlying protocol will be SOAP.
*use the EJB components, to have Remote Calls, the underlying protocol will be RMI/IIOP. and the swing client will use JNDI and EJB Home methods (create or findByXXX)
If you want my advice... have a look to the Petstore Reference application (there is an example of swing client) on this site (JavaBluePrints).
after that, choose your "middletier layer" technology, abd buy a book on this (I prefer O'reilly's ... Java Servlet by Jason Hunter or EnterpriseJavaBeans by Richard Monson Haefel)
Good design !
gui at 2007-7-6 12:27:43 >
