8 Replies Latest reply: May 2, 2013 1:15 AM by csh RSS

    JavaFX as a SaaS/ How good is it for Client-Server work?

    KonradZuse
      I was under the impression that FX could be used to produce a Client-Server application as well as SaaS.

      a member of another forum said "I'm sure you meant to say "Desktop". JavaFX will not be making inroads on the web as a client-side technology."

      To which I said
      There have been examples of FX used with EE

      http://www.oracle.com/technetwork/java/javafx/samples/index.html

      http://docs.oracle.com/javafx/2/overview/jfxpub-overview.htm

      Sales Dashboard (DataApp)
      DataApp is a client-server application for a fictional global automobile company called Henley Car Sales. Automobile sales are simulated on an EJB server using JavaDB, and the data is available via Derby and a RESTful web service. The client demonstrates a variety of data presentations by using a mix of FXML and JavaFX.

      I thought originally that JavaFX was "Desktop" only also, until I found this example. I couldn't get it to run due to some weird Database line read issue that others also had. I'm not sure if this is now due to FX's integration, or if this was something new, but I believe I have seen another FX client-server app as well.


      I'm not that familiar with the client-server side of Java yet, so if you have other Information I would like to know, because I am looking to design a Client-Server app with FX, and I don't see why it would be an issue, unless there are huge limitations."


      He ended up saying "Those are still desktop apps. Sure, they are client-server in that they connect to a remote database. But they are still traditional fat-client apps rather than web-based thin-client SAAS web applications which, these days, most people will think of when you say "client".

      My point is to be more precise when you use the word "client".

      But if your point is just that JavaFX is taking over from Swing for the limited areas in which Swing is used, I have no insight into that area."




      Now I don't really like attitudes when I get my question answered, but the high and mighty needs to stop. It clearly says Client-Server so I don't know why it's being denounced by this dude who thinks he obviously knows better.



      Anyways he talks about it only being able to connect to a DB, to which it says it uses EE tech such as EBJ, Restful, and Derby, so that's more than just DB right(I don't know since I havent' learned that yet)?


      It seems as if he's saying that only EE code can go up on a server? Or can SE code go up there as well?



      I'm looking to design a SaaS software with FX, so if this isnt' possible I would like to know possible other options(or just having all of the gui work on the client, and the rest on the backend)???


      Thanks!


      ~KZ

      Edited by: KonradZuse on Apr 30, 2013 11:26 AM
        • 1. Re: JavaFX as a SaaS/ How good is it for Client-Server work?
          csh
          A lot of text, but I am still not sure, what your question is.

          JavaFX is only the client-side UI framework on top of Java SE.

          Of course you can built a Client-Server application where JavaFX is the client part (the fat desktop client as your source called it)

          How you communicate to the server is on a complete other side.

          You will probably need some libaries like Apache Commons HTTP Client to use REST services.

          For the REST services you could use Java EE stuff (EJB...) but it could also be in another technology if you want.

          Your client then communicates with that server using Standard Java. And if you want to display the results in a nice UI, rather than in the console, you can use JavaFX.

          Hope that answers your question!? (still not sure, what it was)
          • 2. Re: JavaFX as a SaaS/ How good is it for Client-Server work?
            Jeff Martin
            I've been working on a Client/Server workbench for JavaFX: http://reportmill.com/javi

            I think it's perfect for the task.

            jeff
            • 3. Re: JavaFX as a SaaS/ How good is it for Client-Server work?
              jsmith
              I've used it as a front end to create a custom GUI for salesforce using the salesforce apex rest api to create a SoqlXplorer type app - it was great for that . . .

              http://www.salesforce.com/us/developer/docs/api_rest/
              http://www.pocketsoap.com/osx/soqlx/ (this is not my app, my app just looks and functions a bit like this).
              • 4. Re: JavaFX as a SaaS/ How good is it for Client-Server work?
                KonradZuse
                Sorry I'm just really really really confused.

                I have only done "client/desktop" coding, so I'm new to server side code.


                Basically I am creating a business application that I want to use as a client-server, or possibly a browser web application. I'm curious if I can use FX in an web app, or it's ONLY for Desktop usage?


                It seems that SaaS is the way to go, but I'm not sure how I should approach it.


                The application itself needs 3D manipulation, which is why I;m using FX. There is also the possibility of using WebGL I guess?

                I just think downloading the application and running it via the client/grabbing data from the server is okay, but someone else I'm doing this with thinks it's better to do a login on a browser and go the web application route.


                I know this is a little outside the scope of FX, but I wasn't really sure where to post it as the EE sub forums are many :(.

                Again I don't know ANYTHING about web applications and server side, so any help would be appreciated :).


                Thanks!

                Edited by: KonradZuse on Apr 30, 2013 2:00 PM

                Will check out inventor, thanks again!

                @Jsmith, nice demo.
                • 5. Re: JavaFX as a SaaS/ How good is it for Client-Server work?
                  csh
                  In your case I'd start with the server side, because a client usually can't live without a server side, but a server side can live without a client.

                  In the mean time discuss with your colleague, which way you want to go on the client side.

                  HTML 5 or JavaFX. There are many pros and cons for each other, which you can find many of in the www.

                  JavaFX can run in a browser as an applet, but I doubt it is well suited for large web application.
                  Maybe you can also decide to only make the 3D stuff with JavaFX.

                  But as I said, start with the server side. Then you have enough time to decide for the client side and it's usually better to start with the server side for a new project.

                  If you have no experience with the server side, it's a long way though. You will need to understand how databases work, how JPA works, how REST works, and some other minor things like dependency injection are also useful. All this Java EE stuff is a large topic.
                  • 6. Re: JavaFX as a SaaS/ How good is it for Client-Server work?
                    KevinPas
                    This response is not a tutorial, I hope it gives you some verbiage to use in further searches.

                    SaaS to me means that the service is running on the server. If you have the server and permission to run java apps there then you can use Java FX by having the server shuttle requests to the Java FX app. But this is probably not the intent of Saas (it would be more appropriate to use a java implemented web service).

                    If you are using Netbeans then it is very easy to create demo projects; use "File/New Project" to run them on your local computer.

                    Example File/New Project/Java Web/Web Application will give you a hello world web site very quickly. This will 1) start either tomcat or glassfish as the server. 2) launch an html page with "hello world". then you can use java script to talk with the server via ajax. Using this approach you are going to need to study JSP or J2EE stuff.

                    After this is running you could start one of the Java Fx examples in Netbeans: File / New Project / Samples / WebViewBrowser. This will start a javaFX app that acts like a browser and runs on the client.

                    So, start the "hello world" app in netbeans by right clicking it in the project pain and selecting "debug". Then start the webviewBrowser app the same way to load that web page that has "hello world" in it as all browsers do. In the WebviewBrowser (which is java fx) you can get at the javascript in the web page and do all kinds of stuff. You'll need to search for webviewBrowser examples.

                    The above all assumes a Netbeans solution. But, as you probably know, there are no rules. The server can be in C++ and the client in C (or any other language). The server and client usally communicate via http or tcp. So you could have a server written in java (maybe J2ee or you can rewrite a http server from scratch which isn't that hard - search for "HttpServletRequest and HttpSession" ) and the client can be in Java FX (where the Java FX talks directly with the server via http (no javascript or web page in the middle) again there are probably hundreds of libraries to talk to a http server).

                    I use HttpServletRequest and HttpSession on the server side with MySQL and xml. On the client I use javaScript but I am moving to a strictly Java FX solution. This will give me close to 100% java on both sides and for my purposes this will work. (I may need a little html in the middle for drag and drop installation.) I am hoping that work continues with porting Java FX to most devices: Android, IOS, WinPhone. It is already on Linux, Windows Desktops and Mac.

                    Edited by: KevinPas on May 1, 2013 9:50 AM

                    Edited by: KevinPas on May 1, 2013 9:56 AM
                    • 7. Re: JavaFX as a SaaS/ How good is it for Client-Server work?
                      KonradZuse
                      We ended up going with that it's probably a better idea to go with it on the desktop and work it as a client and grab data from the server when needed. I'm assuming I will only need a few things. With Netbeans I shouldn't have an issue connecting to a DB, or doing certain web services, but I'm curious are the DB connections/Web services bundled into the Jar?

                      Should everything be up on the server and just build the application when that data is called? Basically I look at the DataApp example from Oracle http://download.oracle.com/otndocs/products/javafx/samples/DataApp/

                      I had issues connecting to the DB so it just showed a bare FX GUI. I'm assuming that's all I would need to do FX GUI on the desktop, and all the data server side, and then fill as needed?

                      Is there any problem with the approach, or does anyone have any better advice?

                      Thanks as always :),


                      ~KZ
                      • 8. Re: JavaFX as a SaaS/ How good is it for Client-Server work?
                        csh
                        In my opinion it is bad practice to directly operate on the database from the client.

                        As I understood you, you want to do that.

                        There should be at least an abstraction layer between them, usually called the Domain Logic Layer.

                        If you run on the server, you also should not bypass the complete Service Layer (REST).

                        You only want to run a central database, where all clients directly connect to? I wouldn't recommend that.

                        In our architecture, we have a

                        Service Layer (REST and EJB) which receives requests from the clients and forwards it to the
                        Domain Logic Layer which proceeds any logic like validating, encrypting, transforming data and forwards it to the
                        Data Access Objects, which only persist and read from the database.

                        This all runs on the server.