Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am new to StackExchange, but I figured you would be able to help me.

We're crating a new Java Enterprise application, replacing an legacy JSP solution. Due to many many changes, the UI and parts of the business logic will completely be rethought and reimplemented.

Our first thought was JSF, as it is the standard in Java EE. At first I had a good impression. But now I am trying to implement a functional prototype, and have some really serious concerns about using it.

First of all, it creates the worst, most cluttered invalid pseudo-HTML/CSS/JS mix I've ever seen. It violates every single rule I learned in web-development. Furthermore it throws together, what never should be so tightly coupled: Layout, Design, Logic and Communication with the server. I don't see how I would be able to extend this output comfortably, whether styling with CSS, adding UI candy (like configurable hot-keys, drag-and-drop widgets) or whatever.

Secondly, it is way too complicated. Its complexity is outstanding. If you ask me, it's a poor abstraction of basic web technologies, crippled and useless in the end. What benefits do I have? None, if you think about. Hundreds of components? I see ten-thousands of HTML/CSS snippets, ten-thousands of JavaScript snippets and thousands of jQuery plug-ins in addition. It solves really many problems - we wouldn't have if we wouldn't use JSF. Or the front-controller pattern at all.

And Lastly, I think we will have to start over in, say 2 years. I don't see how I can implement all of our first GUI mock-up (Besides; we have no JSF Expert in our team). Maybe we could hack it together somehow. And then there will be more. I'm sure we could hack our hack. But at some point, we'll be stuck. Due to everything above the service tier is in control of JSF. And we will have to start over.

My suggestion would be to implement a REST api, using JAX-RS. Then create a HTML5/Javascript client with client side MVC. (or some flavor of MVC..) By the way; we will need the REST api anyway, as we are developing a partial Android front-end, too.

I doubt, that JSF is the best solution nowadays. As the Internet is evolving, I really don't see why we should use this 'rake'.

Now, what are pros/cons? How can I emphasize my point to not use JSF? What are strong points to use JSF over my suggestion?

share|improve this question
9  
That's a well-written question from a new user. Consider leaving a comment when downvoting. – ThiefMaster Jul 24 '12 at 13:36
2  
Since you are rewriting everything I'd not only consider not using JSF but consider not using Java at all. Modern scripting languages (i.e. not PHP or Perl) are pretty nice and developer-friendly. – ThiefMaster Jul 24 '12 at 13:37
3  
Java is the best choice if your application is going to be large (either complex and/or scalable) and/or distributed, using many services; if your application does not fit in this category (is not so complex and does not need to be scalable) then Python (Django) or Ruby (Rails) would be better choices. The complexity of JSF, has the benefits of the power it comes with; as alternatives to it you should take a look at other Web Frameworks such as Spring MVC or Struts 2 if Java is mandatory. – m3th0dman Jul 24 '12 at 14:17
5  
This is a rant looking for backup, not a question as such. – user1249 Jul 25 '12 at 12:45
2  
@ThorbjørnRavnAndersen: Every question about "how can I get my company to buy-in to x technology?" is the same question, but in reverse. We answer all of those and leave them open... – Steve Evers Jul 25 '12 at 23:51
show 12 more comments

closed as not constructive by gnat, Matthew Flynn, Walter, Thorbjørn Ravn Andersen, A----------------------- ----- Jul 25 '12 at 12:55

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

4 Answers

up vote 2 down vote accepted

There is at least one very good reason for considering JSF.

It is a standard part of the Java EE stack, and hence will be available - and working - in ALL Java EE containers for a very, very long time. And maintained too, without you needing to do so if you have adhered strictly to the Java EE specification.

If this is a concern for you, then you should consider it. Most software live longer than their designers think, especially if taken in consideration when being written.

share|improve this answer
1  
+1 That's the first real reason I can accept. – Vain Fellowman Jul 25 '12 at 13:04

Now, what are pros/cons? How can I emphasize my point to not use JSF? What are strong points to use JSF over my suggestion?

You already seem to have made upt your mind about the cons, and I have to a gree with some of them (it does not separate layout and logic enough, and the resulting HTML is often atrocious), but disagree on others (if you use Facelets, which I would very much recommend, then the output should definitely be valid).

So here's some pros:

  • There are some very powerful component libraries like PrimceFaces or RichFaces that offer a lot of functionality out of the box. These can save you a lot of work if they cover your requirements (not so much if you have non-negotiable requirements not covered by them).
  • Composite Components offer a very clean way to modularize your pages
  • JSF integrates very well with the rest of Java EE
  • AJAX via component re-rendering is really easy and convenient

But certainly none of these advantages are so big that you should use JSF over some other framework that your team already has experience with.

share|improve this answer
Thank you for your input. It's actually the PrimeFaces library, that produces invalid output. I have close to nothing in the prototype yet (3 widgets), but 19 Errors and 2 Warnings. – Vain Fellowman Jul 25 '12 at 6:10
@Vain: well, it's been 2 years since I used PrimeFaces, so things may have changed, and my memory is vague. I remember having some validation errors, but they were all of the same 1 or 2 types, which I was able to fix through configuration changes (something having to do with generated element IDs?) – Michael Borgwardt Jul 25 '12 at 7:16
1  
It's not the IDs, it's invalid attributes. Like "role" and "aria-expanded" in the tab view. Do you know how to fix this? – Vain Fellowman Jul 25 '12 at 7:27
1  
@Vain: nope, seems to be a different issue, perhaps with a component that I did not use or which is new. It's possible to change the HTML output of JSF components by specifying an alternative renderer (which ideally just overrides one or two methods of the default renderer), but of course this is not something you should have to do just to get valid markup. – Michael Borgwardt Jul 25 '12 at 7:41
1  
Revisiting my first question here, I would like to share some experience about your pros: We are working with JSF, and with that experience we wouldn't choose it again. Barely anything works as expected and out of the box. Yes, there are powerful Libraries. But we ended up doing all our components ourselves, because they wouldn't work quite as we needed it. It's stunning how fast we had our own 'DataTable' with lazy loading while scrolling. Composite Components didn't work for us, I can't tell you why, they are buggy I guess. AJAX re-rendering is actually a pain for client side JS. – Vain Fellowman Feb 7 at 7:41
show 4 more comments

We had a legacy JSP/Struts 1.0 application. We skipped Struts 2, JSF and everything else that has happened since Struts 1 and jumped in to Spring 3.0. It has support (and an active community) for our wish list - Eclipse IDE, MVC and REST. Plus we ditched our vintage homegrown Javascript/ajax for jquery.

YMMV but Spring has been a smooth migration for us.

share|improve this answer

JSF is adequate stateful web framework for Java that is a standard which means its supported out of the box by many major vendors (including FOSS ones). It has strong 3rd party library support (PrimeFaces, IceFaces etc). However, it does fundamentally 'break the web' due to its stateful nature (and a bunch of other things). See Matt Raible's comparison of JVM based web frameworks, JSF usually comes close to last.

share|improve this answer
1  
It 'breaks the web', indeed.. And thanks for Matt Raible's comparison, didn't know that. – Vain Fellowman Jul 25 '12 at 6:02
1  
Note that JSF is not necessarily stateful. I agree it often is, but there's pretty good support for stateless GET based requests and if you don't use a form then there's no state at all. – Arjan Tijms Jul 29 '12 at 18:47
Fair point Arjan, I guess I've just seen to many stateful uses. – Martijn Verburg Jul 30 '12 at 8:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.