Nobody Uses JavaServer Faces

So, I’m going to take a quick detour from Cocoa development for a moment as at my day job I am working on a Java project. The application simply displays a list of items on the first page and then provides a link for each item to a details page. It’s pretty simple, however, it’s taken me two weeks to get it to the point where it actually displays the data. Now I’m working on formatting fields so that dates don’t just display as unix time stamps and fields that are labeled “Reachable” display as “Yes” or “No” rather than as “true” or “false”, etc.

I am using JavaServer Faces for the project as the technology to be used was specified in the design. If you’re not familiar with JSF, it’s a bit like Java Struts. It uses tag libraries, but it does a good job of implementing a true MVC (Model View Controller) architecture. My kudos for the technology, however, stop there. I’ve read many articles touting how JSF is going to be the great new web development technology that everyone will be using. It constantly gets compared to ASP .NET and seems to nearly always come out on top in such comparisons. Yet, I have yet to find any redeeming qualities. As much as I despise ASP .NET, it is a dream compared to JSF.

A quick word from our sponsor:
Get 250GB of Web Space and 2TB of traffic for $5/month

I can’t debug anything with break points as everything is compiled into a java class at run time and all I ever see are tags, not Java code. It is so far abstracted that I can’t get to the guts of it if I tried. If you recall, I am not terribly fond of black boxes and this has got to be one of the worst ones I’ve seen yet. I will complete the project using JSF, but I am not impressed in the least. If the design didn’t have mandated that I use JSF, I would have had this project done the same day it was assigned as I would have written it in PHP. It’s the right tool for this job, frankly.

And that brings me to the point. JSF is a technology that looks good on paper, but when it comes to actually using it, it stinks. I have come to the conclusion that nobody uses JSF simply because when I do a web search to find the answer to the simplest of questions, I find nothing useful. Sure, there are tutorials out the wazoo, but not a single one of them is shorter than 15 printed pages and most of them show you how to make some retarded calculator application that is in no way any sort of representation of a “real-world” app. Fifteen printed pages to demonstrate a calculator? Wow! JSF is impressive!! Maybe fifteen pages is an exaggeration, but I’ve seen many tutorials that are very long and by the end of them all you’ve done is taken input from the user in a single text field and responded in a new page with “Hello {name}. It is currently {datestamp}”. Not exactly useful or helpful.

Ok, I’m done ranting. If JSF is your favorite technology (though I doubt there is a single soul that cares in the least–time will tell), I’m sorry if I’ve stepped on your toes. You probably will surmise that I just don’t understand it well enough. That may be true, however, there is overwhelming evidence that the people who use it are few and far between and very few people consider it worthy of writing a proper tutorial with reasonable explanations. The bottom line is I’ve done a lot of web applications in my career, and I would *never in a million years* choose JSF to build a web app. It’s nearly unusable. Don’t get me wrong. I am getting the project done, but that’s a testimony to my own development skills, not how great the technology is. JSF stinks. That’s my story, and I’m sticking to it. Feel free to disagree in the comments.

12 thoughts on “Nobody Uses JavaServer Faces”

  1. Well, I also agree JSF is quite complicated. I think in the Java world, wicket is a way nicer webframework. It is comparable to Asp.net.

  2. -JSF is a very productive web framework, i used it a month ago and i was pleased very much from using it.
    -My opinion is that you didn’t understand JSF or you didn’t knew how to work with JSF.
    -I will give a small example with struts, Struts beginners always make an action class for every action method, working with such bad practice is not struts problem, using JSF with JSP is a very bad practice .
    -I knew that JSF has many bad sides but all these sides was improved today.

    Note:. i was forced to use the first release of JSF and the first release of rich faces with all there bugs and i’m very pleased with such a technology.

  3. Nice comparison on your site, ptrthomas. Funny how people argue to say that your example is “trivial”. All of the examples I’ve found for JSF are nothing if not trivial, yet they take a very long article to explain them. There is no reason to pain yourself just to use some technology to accomplish something that a different technology does much simpler. That wasn’t true in the 70s and 80s. Then you had to use whatever was available. That’s not the case any more. While we all have preferences, it really boils down to using the right tool for the job.

    -Matt

  4. I can’t debug anything with break points as everything is compiled into a java class at run time and all I ever see are tags, not Java code. It is so far abstracted that I can’t get to the guts of it if I tried.

    First, a disclosure: I’m a developer on Mojarra, Mojarra Scales, and am a member of the JSF EG. I’ve been using JSF for almost 3 years now, and really enjoy it, which led, eventually to my committer status and EG membership. Now, with that out of the way…

    I’ve not found debugging to be a problem, really, though I’ll admit that some may find my approach… arcane. :) Typically what I do is this: I’ll develop in Netbeans (previously Eclipse), but use the command-line to build and deploy my artifact. In my IDE, I set break points where I need them, then attach my IDE’s debugger to my app server (GlassFish, fwiw). When I hit the context the break points are tripped and my IDE comes to the front, allowing me to do all of the normal debugging things. Eclipse even does a nice job of replacing the code on the server if I need to make a change in my app (though it’s not perfect). Using that approach, I’ve been easily able to step through my apps. I would imagine that that approach would work regardless of the framework used.

    As far as debugging the tags, generally, I wouldn’t think you would need to do that (unless you’re developing custom tags, which it doesn’t sound like you’re doing). Though, if you need to, the approach above would work as well: just find the UIComponent or Renderer class for the tag in question and set your breakpoints. If by debugging the tag, you meant the point where your application and the interacts, you just need to place a break point on the method specified in the Expression Language expression (nice redundancy, huh?) and the BP will trip when JSF processes that tag, allowing you to step through that method.

    I hope all that makes sense. And helps. :) I’ve written many, many apps in JSF and really do prefer it. Rick Hightower has some interesting (though admittedly debatable numbers) on JSF uptake on DZone: http://java.dzone.com/news/jsf-catches-swing-number-one-g. For what that’s worth. :)

    If the design didn’t have mandated that I use JSF, I would have had this project done the same day it was assigned as I would have written it in PHP. It’s the right tool for this job, frankly.

    And that might be the heart of the problem. As much as I love JSF, I’ll readily admit that it’s not the right tool for every job. In fact, I’ve written JSF apps that probably would have been easier (and quicker and smaller) in PHP, but, since we were a Java shop, that wasn’t an option (and, being small, we couldn’t afford to have an explosion of technologies), so we shoved the square peg in the round hole. For larger apps, though, I like the component-driven approach of JSF, and I think it does a great job of encapsulating the functionality of those components.

    I blog quite a bit on JSF-related issues on my blog (http://blogs.steeplesoft.com – I promise I’m not here to promote my own blog. Just thought it might help ;) if you care to read any of those or ask any questions. I’m more than happy to help where I can.

  5. First of all this not true:

    If you’re not familiar with JSF, it’s a bit like Java Struts

    they are very different frameworks.

    Second, did you have any JSF training before starting to code? What you described can be created in about 1 day if you actually know how to use the framework. Yes, there is a learning curve, but please don’t blame the framework before you know how to use it.

    Max
    http://mkblog.exadel.com

  6. Hey Max,

    they are very different frameworks.

    Which is why I said “a bit like…”. There are enough similarities for this to be a reasonable statement, though.

    Second, did you have any JSF training before starting to code?

    Herein is my point–and you make it well. The first PHP app I wrote I was able to put together in a day without *any* previous training. I read a few examples (which are ubiquitous) online and coded my app. It’s intuitive. It’s the right tool for the job for many web applications–especially ones as simple as this. Other tools are good at this as well.

    By comparison, there *is* a learning curve with JSF, as you point out and there is no good documentation I can find online. If I don’t blame the framework for being difficult, the who do I blame? I didn’t make it difficult or non-intuitive to use. My question is why punish myself using a framework that is naturally cumbersome and requires me to go through training when I can get the job done sooner (time..money…etc.) with something else?

    Furthermore, the main point I made is that nobody uses JSF. Now, of course, I don’t mean literally nobody. I mean virtually nobody. In other words I’m sure there are a couple people out there who use it–maybe even in a production environment. However, I think the rest figured out it’s too much of a pain to wrestle with. Again, as I pointed out in the original post, If someone can provide me with a good tutorial that isn’t 15 pages long and in the end provides more than a silly calculator, I’d be glad to take a look and change my viewpoint. To me, the point is clear–most people aren’t willing to punish themselves to do something with a framework that virtually nobody uses–especially when so many other frameworks exist that do what I’m trying to do easier, faster, and, frankly, better.

    Best Regards.

    -Matt

    p.s. I can understand why you would suggest training as it looks like you teach people JSF. Do you get $495 for online JSF training? That’s not a jab. I’m just curious as this could discredit the premise of my entire post. How many people sign up for such a course?

  7. Instead of just bashing JSF why don’t you post snippets from your example app that took you so long to build and add detail to your difficulty? That would be useful and informative. Instead it sounds like you are complaining because you needed to learn something new to use a different technology. Is that really surprising? Do you mean that you have never read any instructions (i.e. book) more than 15 pages long? Come’on, you’re starting to sound a bit disengenous on that point. If that’s your logic then I don’t recommend the Spring Framework to you either.

  8. @MD10024

    I’m planning to do exactly that (publish a JSF tutorial) when I’m finished with my project. I’ll let you know how that goes.

    I think you missed my point about 15 pages. I have read many books and many more articles and rely on them heavily to do my work. The point was that it took 15 printed pages to explain something that could be explained in 15 *lines* of code in PHP. It’s a huge discrepancy.

    Best Regards.

    -Matt

  9. One of the issues is that people take their PHP or JSP experience and style of development and try to apply it to JSF. But it simply doesn’t work that way, JSF provides a different paradigm to developing the UI, you build the user interface out of UI components. JSF also has a pretty sophisticated page life cycle, which is crucial to understand.

    JSP lets you do anything you want basically, that’s why it is pretty easy to start. But when you can do anything you want, it doesn’t mean you did it the correct way. JSF guides you “how” to develop your application, so some sort of at least basic training is mandatory.

    There are numerous tutorials, articles and everything else on JSF on the Internet today. Additionally, there are 4-5 books available.

    There are a lot more than just a few people that use JSF. I’m at JBossWorld conference in Orlando, FL right now and virtually everyone uses JSF for web development.

    Yes, $495 is the price for online training offered by Exadel (the company I work for).

    Max
    http://mkblog.exadel.com

Leave a Reply