What is the technology stack behind IRCTC

What are the main disadvantages of Java Server Faces 2.0?


Yesterday I saw a presentation on Java Server Faces 2.0 that looked really impressive, even though I'm currently a happy ASP.NET MVC / jQuery developer. What I liked most about JSF was the large number of AJAX-enabled UI components that seem to make development much faster than ASP.NET MVC, especially on AJAX-heavy sites. Integration tests looked very good too.

Since the presentation only highlighted the benefits of JSF, I would like to hear from the other side as well.

So my questions are:

  • What are the main disadvantages of Java Server Faces 2.0?
  • What Could Make a JSF Developer Use ASP.NET MVC Instead of JSF?

Reply:


JSF 2.0 disadvantages? Honestly, aside from the relatively steep learning curve if you don't have a solid background in basic web development (HTML / CSS / JS, server versus client side etc) and basic Java servlet API (request / response / session) have, forwarding / forwarding, etc.) there are no serious disadvantages. JSF in its current version still needs to get rid of the negative image it gained in the early years when there were several serious drawbacks.

JSF 1.0 (March 2004)

This was the first publication. It was full of flaws in both core and performance areas that you don't want to know about. Your web application did not always work as you intuitively expected. As a developer, you would run away crying.

JSF 1.1 (May 2004)

This was the bugfix version. The performance has not yet improved significantly. There was also one major drawback: you cannot properly embed HTML into the JSF page. All simple vanilla html files will be in front rendered to the JSF component tree. You need to tag all simple vanilla in order for it to be included in the JSF component tree. Although this conformed to the specification, it was criticized many times. See also JSF / Facelets: Why is it not a good idea to mix JSF / Facelets with HTML tags?

JSF 1.2 (May 2006)

This was the first release by the new JSF development team, led by Ryan Lubke. The new team did a great job. There were also changes in the specification. The most important change was the improvement in view handling. Not only did this completely separate JSF from JSP, allowing a different viewing technology than JSP to be used, but it also allowed developers to include simple vanilla HTML in the JSF page without having to mess with tags. Another focus of the new team was improving performance. During the lifetime of the Sun JSF reference implementation 1.2 (which has been codenamed since build 1.2_08 around 2008 Mojarra practically every build was delivered with (major) performance improvements in addition to the usual (small) bug fixes.

The only major downside to JSF 1.x (including 1.2) is the lack of a range between the Requirement and the Meeting area , the so-called Conversation area . This forced developers to deal with hidden input elements, unnecessary DB queries and / or abuse of the session area if the original model data were to be retained in the subsequent request in order to successfully process validations, conversions, model changes and calls to action in complex web applications. The pain could be alleviated by using a third party library that stores the required data in the subsequent request such as MyFaces Tomahawk component, JBoss Seam conversation volume, and MyFaces Orchestra conversation frames.

Another disadvantage for HTML / CSS purists is that JSF uses the colon as an ID separator to ensure the uniqueness of the HTML element in the generated HTML output, especially when a component is used multiple times in the view (templates, iterating components, etc.). . Since this is an illegal character in CSS identifiers, you'd have to use that to bypass the colon in CSS selectors, resulting in ugly and weird looking selectors like or straight. See also Using the HTML element ID generated by JSF with a colon ":" in CSS selectors. However, if you're not a purist, see By default, JSF generates unusable IDs that are incompatible with CSS parts of web standards.

In addition, JSF 1.x did not immediately ship with Ajax functions. Not a real technical drawback, but due to the Web 2.0 hype around the time, it turned into a functional drawback. Exadel was early to adopt Ajax4jsf, which has been thoroughly developed over the years and has become a core part of the JBoss RichFaces component library. Other component libraries have also been delivered with integrated Ajax functions, of which ICEfaces is known.

About halfway through the life of JSF 1.2, a new XML-based viewing technology was introduced: Facelets. This offered enormous advantages over JSP, especially in the area of ​​templating.

JSF 2.0 (June 2009)

This was the second major version with Ajax as a catchphrase. There have been many technical and functional changes. JSP is being replaced by Facelets as the standard viewing technology, and Facelets has been expanded to include capabilities for creating custom components using pure XML (known as composite components). See also Why are facelets from JSF2.0 preferred as view definition language to JSP?

Ajax powers were introduced in the flavor of the component, which has many similarities with Ajax4jsf. Notes and enhancements to the configuration convention have been introduced to terminate the verbose file as much as possible. In addition, the standard separator for the ID of the name container was configurable, so that HTML / CSS purists could breathe easier. All you have to do is define it in by name and make sure you are not using the character itself anywhere in client IDs, such as.

Last but not least, a new area was introduced, the Viewing area . It eliminated another major disadvantage of JSF 1.x, as described earlier. You simply declare the bean to activate the conversation scope without affecting any ability to retain the data in subsequent (conversation) requests. A bean lives as long as you then send it and navigate to the same view (regardless of the tab / browser window that is open!), Either synchronously or asynchronously (Ajax). See also Difference Between View Scopes and Requirements Scopes in Managed Beans and How to Choose the Correct Bean Scope?

While practically all of the disadvantages of JSF 1.x have been removed, there are JSF 2.0-specific bugs that could stop the show. Tag handlers fail because of a chicken egg problem when partially saving the state. This is fixed in JSF 2.2 and backported in Mojarra 2.1.18. Passing user-defined attributes such as HTML5 is also not supported. This is fixed in JSF 2.2 with the new function for passthrough elements / attributes. In addition, the JSF implementation Mojarra has its own problems. Relatively many of them are related to the sometimes unintuitive behavior of, the new implementation for saving partial states and the poorly implemented flash area. Most of these are fixed in a Mojarra 2.2.x version.

Around the time of JSF 2.0, PrimeFaces was introduced, based on jQuery and jQuery UI. It became the most popular JSF component library.

JSF 2.2 (May 2013)

With the introduction of JSF 2.2, HTML5 was used as a catchphrase, although technically this was only supported in all older JSF versions. See also Javaserver Faces 2.2 and HTML5 support, why is XHTML still being used. The main new feature of JSF 2.2 is the support of custom component attributes, which opens up a variety of possibilities, such as: B. Custom tabeless radio button groups.

Apart from implementation-specific bugs and some "annoying little things" like the inability to insert an EJB into a validator / converter (already fixed in JSF 2.3), there are no really big disadvantages in the JSF 2.2 specification.

Component-Based MVC vs Requirements-Based MVC

Some may decide that the main disadvantage of JSF is that it allows very little fine-grained control over the HTML / CSS / JS that is generated. That's not JSF's own just because it's a component-based MVC framework is, no request (action) MVC framework. If a high level of control over HTML / CSS / JS is your main requirement when considering an MVC framework, then you shouldn't be looking at a component-based MVC framework already, but a requirements-based MVC framework like Spring MVC. You just have to take into account that you have to write all of the HTML / CSS / JS boilerplate yourself. See also Difference Between Requirements MVC and Component MVC.

See also:







After 5 years of working with JSF, I think I can add my 2 cents.

Two main disadvantages of JSF :

  1. Big learning curve. JSF is complex, that's just true.
  2. His Components Nature. The component-based framework tries to hide the true nature of the web, which is fraught with a multitude of complications and disasters (e.g. the non-support of GET in JSF within almost 5 years).
    IMHO, hiding HTTP request / response from the developer is a huge mistake. In my experience, every component-based framework adds abstraction to web development, and that abstraction adds unnecessary overhead and complexity.

And small Cons that come to mind:

  1. By default, the ID of the object is made up of the IDs of its parents, e.g. B. form1: button1.
  2. Not an easy way to comment out the fragment of a wrong page. The tag needs syntactically correct content, which is analyzed anyway.
  3. Low quality 3rd party components for example do not check inside method before proceeding.
  4. Integrating LESS & Sencha is difficult.
  5. Doesn't play well with REST.
  6. Not that easy for UX designers as ready-to-use components have their own CSS styles that need to be overridden.

Do not get me wrong. As a component framework, JSF is really good at version 2, but it's still component-based and always will be ...

Please take a look at the low popularity of Tapestry, Wicket, and the low level of enthusiasm from experienced JSF developers (which is even more telling). For contrast, check out the success of Rails, Grails, Django, Play! Framework - all are action based and don't try that true request / answer and the stateless character of the web from the programmer.

For me, it's a huge downside to JSF. IMHO JSF works for some types of uses (intranet, form intensive) but real Web applications is this is not a good way.

Hope it helps someone with their front-end decisions.





A couple of cons that come to mind:

  1. JSF is a component-based framework. This has inherent limitations that have to do with following the component model.
  2. AFAIK JSF only supports POST. So if you want a GET anywhere, you need to run a simple servlet / JSP.
  3. Most components attempt to expose abstractions through domains such as relational databases and front-end JavaScript, and often these abstractions are "leaky" and very difficult to debug.
  4. These abstractions might be a good starting point for a junior developer or someone unfamiliar with a particular domain (such as front-end JavaScript), but they are very difficult to tweak for performance because of the multiple layers involved and most of the users using them have little understanding of what's going on under the hood.
  5. The template mechanisms typically used in JSF have nothing to do with how web designers work. The WYSIWYG editors for JSF are primitive and either way your designer is giving you HTML / CSS that will take a long time to convert.
  6. Things like EL expressions aren't checked statically, and both the compiler and IDEs don't do a good job of finding bugs. Therefore errors occur that you have to catch at runtime. This may be fine for dynamically typed languages ​​like Ruby or PHP, but if I have to withstand the bloating of the Java ecosystem, I'll have to enter my templates.

All in all: The time you save with JSF by not having to write the JSP / servlet / bean boilerplate code, you've spent x10 to have it scale and do exactly what you want.







For me, the biggest downside to JSF 2.0 is the learning curve of not just JSF but the component libraries you need to use in order for it to do a useful job. Consider the astonishing number of specifications and standards you will deal with to be truly proficient:

  • HTML in the different incarnations. Don't pretend you don't have to know.
  • HTTP - If you can't figure out what's going on, you need to open Firebug and see it. You have to know that for that.
  • CSS - like it or not. It really isn't that bad, and there are at least some nice tools out there.
  • XML - JSF will likely be the first place you use namespaces to this extent.
  • Servlet specification. Sooner or later you'll be calling methods in this package. Other than that, you need to know how to convert your facelets to XHTML or whatever.
  • JSP (mostly so you know why you don't need it in JSF)
  • JSTL (again mainly to deal with legacy frameworks)
  • Expression Language (EL) in its various forms.
  • ECMAScript, JavaScript, or whatever you want to call it.
  • JSON - you should know this even if you aren't using it.
  • AJAX. I'd say JSF 2.0 does a decent job of hiding this from you, but you still need to know what's going on.
  • The dome. And how a browser uses it. See ECMAScript.
  • DOM Events - a topic in itself.
  • Java Persistence Architecture (JPA) if you want your app to have a back-end database.
  • Java itself.
  • JSEE while you're at it.
  • The Context Dependency Injection Specification (CDI) and how it collides with JSF 2.0 and is used with JSF 2.0
  • JQuery - I'd love to see you do without it.

Once you're done with that, you can move on to the proprietary specs, namely the component libraries and vendor libraries that you will pick up on the way:

  • PrimeFaces (my component library of your choice)
  • RichFaces
  • MyFaces
  • ICEFaces
  • EclipseLink (my JPA provider)
  • Overwinter
  • welding

And don't forget the container! And all these configuration files:

  • GlassFish (2, 3, etc.)
  • JBoss
  • Male cat

So - THAT MAKES IT EASY? Sure, JSF 2.0 is "easy" as long as you want to use only the most basic web pages with the simplest interactions.

Put simply, JSF 2.0 is the most complicated and cumbersome mix of glued together technologies that exists in the software universe today. And I can't think of anything I would rather use.






  1. Inexperienced developers usually create applications that are painfully slow, and whose code is very ugly and difficult to maintain. It's deceptively easy to get started, but it actually requires some investment in learning if you are to write good programs.
  2. At least in the beginning, you will often get "stuck" on a problem and spend more time reading Balusc posts on the Internet than actually working :) After a while, there will be less and less of it, but it can still be annoying .
  3. Even more annoying when you find that the problem is not due to lack of knowledge / mistake, but rather to a mistake. Mojarra was (is?) Pretty buggy, and another layer of components adds even more problems. Richfaces was the biggest crap software ever written :) I don't know how it is now in version 4. We have primefaces, which is better, but you will still run into bugs or missing features, especially with more exotic components. And now you have to pay for Primefaces updates. So I'd say it's buggy, but it gets better, especially after version 2.2 fixes some spec issues. The framework is becoming more mature, but still far from perfect (maybe myfaces better?).
  4. I don't find it particularly flexible. When you need something very, very individual and there aren't any components that do it, it is often a little painful.Again, I'm speaking from the average developer's perspective - the one with deadlines, quick reading tutorials, and stack overflow when you get stuck because you don't have time to learn how it really works :) Often times, some components seem "almost" that to have what you need but not exactly and sometimes you may spend too much time getting it to do something you want :) You have to be careful to evaluate if it is better to make your own To create component or torment existing ones. If you're creating something really unique, I wouldn't recommend JSF.

In short, my disadvantages would be: Complexity, not very smooth development progress, flawed, inflexible.

Of course there are advantages too, but you didn't ask that. Anyway, that's my experience with Framework. Others may have different opinions. The best way is to try it for a while to see if it's for you (just something more complex - no naive examples - JSF really shines there :) IMHO best use case for JSF is business applications like CRMs etc.


"JSF emits view-level HTML and JavaScript that you cannot control or change without using the controller code."

In fact, JSF gives you the flexibility. You can either use standard / third-party components or create your own components where you have full control over what is rendered. It's just an XML code you need to create your custom components using JSF 2.0.


I'm not a Java Server Faces expert at all. But in my opinion the main disadvantage is that it is server-side. I'm tired of learning and using server-side web presentation layer frameworks like ASP.NET Web Forms, ASP.NET MVC, Java Server Faces, Struts, PHP frameworks, and Ruby on Rails frameworks. I said goodbye to everyone and said goodbye to Angularjs and TypeScript. My presentation level runs in the browser. It doesn't matter whether it's served by Windows IIS with PHP or ASP.NET, or by an Apache web server on Linux. I just need to learn a framework that works everywhere.

Just my two cents.




We developed a sample project with JSF (it was three weeks of research so we may have lost some things!)

We're trying to use Core JSF. When a component is needed we have used PrimeFaces.

The project was a website with navigation. Each page should load via Ajax when the menu is clicked.

The site has two use cases:

  1. One side with a grid. The grid is loaded via Ajax and should support sorting and paging
  2. A three-step wizard page. Each page has client-side validation (for simple validations) and server-side Ajax basic validation (for complex validations). Any server exception (from the service tier) should appear on the same page of the wizard without going to the next page.

We found that:

  1. You have to use some hacks from omniFaces to fix the JSF view state. JSF status gets corrupted if you paste pages into each other via Ajax. This seems to be a bug in JSF and can be fixed in the next versions (not in 2.3).
  2. The JSF flow isn't working properly with Ajax (or we couldn't get it to work!). We're trying to use the Primeface wizard component instead, but client validation doesn't appear to be supported, meaning it isn't a standard JSF flow standard.
  3. If you are using some jQuery components like jqGird and need to load JSON results, it is recommended to use a pure servlet. The JSF won't do anything for you. If you use these types of components, your design will not fit in JSF.
  4. We are trying to create some client scripts when Ajax completes and we found that the PF 4 implemented its own Ajax events. We had some jQuery components and need to change their code.

When you turn the above example into a Non-ajax Project (or at least one less Ajax Project), you will not experience many of the above problems.

We summarize our research as:

JSF doesn't work well on a fully Ajax-based website.

Of course, we find a lot of nice features in JSF that can be very helpful in some projects. So take your project needs into account.

For information on the JSF benefits, please refer to the JSF technical documents. In my opinion the biggest advantage of JSF is the COMPLETE AND HUGE support from @BalusC ;-)


For me, the biggest shortcoming of JSF is its poor support for programmatically (dynamically) generated pages.
If you want to build your page dynamically from Java code (build page component model). For example if you are working on the WYSIWYG website constructor. Adequate documentation for this use case is not generally available. There are many points where you have to experiment and develop very slowly. A lot of things just don't work the way you'd expect them to. But in general, it is possible to hack it somehow.
The good thing is that it's not a problem in JSF's philosophy or architecture. It's just not worked out enough (as far as I know).

JSF 2 brought with it Composite Components, which were supposed to simplify component development, but their support for dynamic (programmatic) construction is very poor. If you go through a rather complicated and almost undocumented process of dynamically constructing composite components, you will find that some composite components that are nested a little deeper no longer work and throw some exceptions.

However, it appears that the JSF community is aware of these shortcomings. You are working on how you can see on these two mistakes:
http://java.net/jira/browse/JAVASERVERFACES-1309
http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-599

With JSF 2.2 the situation should be better, at least when it comes to specs.


Comment on my last months with Primefaces / JSF:

  • If you can use "off-the-shelf" components, it probably isn't terrible.
  • However, it doesn't work well once you go outside and need custom user interfaces. - For example, we had to use Twitter's bootstrap for our project. (Not Primefaces Bootstrap).
    • Now our pages work like this:
      • Page is loading.
      • The user interacts with a Primefaces with Ajax functionality
      • Break Bootstrap's Javascript bindings
      • We're running additional Javascript to rebind everything

JSF's promise to avoid writing javascript resulted in more javascript being written than without primefaces - and that javascript fixes what breaks primefaces.

It's a time sink - unless you're back to using "off the shelf". Also very ugly (primefaces) when you have to work with selenium. Everything can be done - but here too there is only so much time.

Definitely avoid this if you are working with a UX / design team and need to iterate quickly on the UI - you can save time by learning jquery / writing straightforward HTML - or looking at React / Angles.







JSF has many advantages. Since the question is at a disadvantage, I would like to add a few points.

In a practical scenario of implementing a web project in a given time period, you need to keep the following factors in mind.

  • Do you have enough senior members on your team who can suggest the best controls that are appropriate for each scenario?
  • Do you have the bandwidth to take on the initial learning curve?

  • Do you have enough expertise on your team to do the
    Review JSF content created by the developers?

If you answered no to the questions, you may be in a non-serviceable code base.


JSF has only one drawback: before you begin "JSF" development, you should have a clear understanding of web development, core Java, and front-end architecture.

Nowadays "new" JavaScript frameworks only try to copy / paste the component based "JSF" model.


Of all the "mainstream" frameworks such as Spring MVC, Wicket, Tapestry, etc., the JSF from Java EE with its composite components is the best developed presentation layer and component-oriented technology. It's a bit cumbersome and incomplete compared to solutions from HybridJava.

We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.

You can read details in our Cookie policy and Privacy policy.