1


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

Cratylus
  • 49,824
  • 60
  • 195
  • 327
  • Which sandbox restrictions in particular? Unless you include extra technologies such as JavaScript, Flash or Java Applets (!), JSF can do even less than restricted java applets. – Hendrik Brummermann Dec 24 '10 at 19:35
  • @nhnb:I am not sure I get your comment, but the problem they have is the implementation of java-security stuff(certificates, keys etc) and apparently sandbox causes a lot of issues – Cratylus Dec 24 '10 at 19:55
  • You need to sign an applet only if it requires more rights than the sandbox offers. The important questions is what are those rights that your applet requires outside the sandbox. If that is for example random access to the hard disk of the client, that will not be possible at all using JSF. – Hendrik Brummermann Dec 24 '10 at 21:45
  • @nhnb:I think the problem is installation of certificates (for PKI) but not sure. It is definitely related to PKI but I am not sure in which part they have problem.Do you by any chance have any idea on this? – Cratylus Dec 25 '10 at 07:19

3 Answers3

3

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:

Community
  • 1
  • 1
BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
  • 1
    Depends on how the applet is designed. If it contains reuseable business/service/data classes which is not tight coupled to Swing (i.e. there are zero `java.awt`/`javax.swing` imports), then you *can* reuse it in JSF. – BalusC Dec 24 '10 at 19:51
  • Interesting comment. I thought that applets were code tags inside html pages. So I always assumed the UI components were from HTML tags. – Cratylus Dec 24 '10 at 19:57
  • No certainly not, applets are just pieces of client side Java software (AWT/Swing/etc) which are to be downloaded from a website. The HTML tags just instructs the webbrowser where to download the necessary software. – BalusC Dec 24 '10 at 20:20
1

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.

Aravind Yarram
  • 74,434
  • 44
  • 210
  • 298
  • Why would I do the same use case in GWT? I lost you in this part – Cratylus Dec 24 '10 at 19:51
  • GWT is Google Web Toolkit. It is a well accepted (or popular) way of implementing THICK CLIENTS like applets. Also, If you implement the same usecase using two different tech stacks then you have more chances of making a good choice. GWT also makes debugging and unit testing easier as your UI will be written in pure Java only. There is no need to work on html, css etc. It also has very good widget support and its UI is better responsive than JSF ui. I suggest you see their showcase samples here: http://code.google.com/webtoolkit/examples/ – Aravind Yarram Dec 24 '10 at 19:57
  • I see, you mean as an alternative to JSF.This is not for me to decide but I will look into this.Is my knowledge on JSP help me learn GWT faster? – Cratylus Dec 24 '10 at 20:00
  • GWT is just java. So your knowledge in Java is the only thing required. that is a major advantage for me. Since it is all java, you can take advantage of all the features that an IDE provides (like code completion, static code analysis, debugging, unit testing etc) for your UI layer code. – Aravind Yarram Dec 24 '10 at 20:11
1

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.

JOTN
  • 5,870
  • 2
  • 24
  • 30
  • How are the conversion libraries from Swing to web-based fit-in here? I do not follow. I asked about applets – Cratylus Dec 24 '10 at 19:53
  • You're not using Swing in the applet? – JOTN Dec 25 '10 at 15:26
  • @JTON:After BalusC comment I understood what you meant.So you are saying that there are libraries that can create from swing components e.g. JTree or JTable equivalent web based UI components?Could you please mention one such library to look into? – Cratylus Dec 26 '10 at 11:04
  • 1
    The one I've heard people talk about is wings. I haven't used it. http://www.wingsframework.org/cms/ – JOTN Dec 26 '10 at 19:10
  • @JTON:Thanks I'll look into this.From a first read though this seems to claim to be a replacement of JSF.Also I thought that it would create a ready swing program an reuse it. It seems developer has to write code – Cratylus Dec 26 '10 at 19:58