Cratylus
Cratylus

Reputation: 54084

upgrade to javaserver faces. Easy task?


I have the following question:
First of all, I know (and have some academic experience on) JSP and Struts but I know nothing at all about JSF.
There is a project that has its front-end already made using applets.
I was asked to look into to change/upgrade it to JSF.
So my question is, is this an easy or at least straightforward task?
I am asking this since i)I do not know the learning curve of JSF and ii)I have given up on learning applets long time ago (I presumed this technology dead)
Any input on this is highly welcome!
UPDATE: If it makes any difference, they want to leave applets due to the sandbox restrictions.
Thanks

Upvotes: 1

Views: 267

Answers (3)

BalusC
BalusC

Reputation: 1108852

Programming in JSF requires solid knowledge of the Servlet API and understanding of the ideology behind using a (component based) MVC framework on top of Servlet API. It also requires solid understanding of the "client side" and "server side" aspects in web development. If you lack any of those understandings, then the learning curve will indeed be pretty steep.

With JSF you basically end up with a JSP or XHTML (Facelets) page as View and an ordinary Javabean class as Model. You also need to realize that an applet is basically a piece of software which runs at the client machine and that JSF runs on webserver, generates HTML/CSS/JS which get sent to the webbrowser where it get interpreted/applied/executed. It doesn't run Java code at the webbrowser as an applet can do. It's a huge difference.

To get started with learning JSF, you need at least to have the minimum required skills for Java webdevelopment, then you can start with either of the following tutorials:

Upvotes: 3

Aravind Yarram
Aravind Yarram

Reputation: 80186

Moving from Struts to JSF is a paradigm shift in the way you approach a problem (my opinion). Struts uses action based model while JSF uses component model (something like writing a desktop GUI application using Swing etc). And to make things even harder for developers, JSF comes with complex request processing life cycle backed up by a no-good-for real world problems implementation in JSF 1.1.

I've seen people moving from struts to JSF struggling a lot and thus producing a code base that is mix of both the worlds (action based and component based). This mixed code base is very hard to maintain and debug.

Having said that, JSF is still the spec and if you can use JSF 2.0 (or atleast JSF 1.2) with Facelets, then my suggestion is to do a simple proof of concept considering the below factors

  • Learn the basics JSF 2.0 or 1.2 with Facelets
  • Take up a complex use case (in terms of dynamic UI) supported by the current applet
  • Build it end to end covering validation, templating, listners, actions
  • Then do the same usecase in GWT or Vaadin. I am suggesting this because your users are currently used to thick clients using applets and GWT is meant for this

And if you finally happen to choose JSF 1.2 or 2.0 then I highly recommend using the PrimeFaces component suite. It is fast, simple and rich with components.

Upvotes: 1

JOTN
JOTN

Reputation: 6317

In general I don't think I'd call that an easy and straight forward conversion, because the environments are so different. With the applet the java code runs on the client system and communicates back to the server with some kind of protocol. JSF runs all the code in the server and can access your data directly. For planning purposes, I would not expect to be able to use any of the existing UI code.

There are libraries out that that take your Swing program and turns it into a web based application. I haven't used any of them, but I know people that have had good success. It would depend on which direction you want to take the application. JSF is gaining ground so the tools based on it will only get better.

Upvotes: 1

Related Questions