Sunday, January 5, 2014

I was reading about JSF that its a UI framework and provides some UI components. But how is it better or different from number of components that can are available from extjs or jQuery or combination of css and html and js. Why should someone learn JSF.
share|improve this question
advantages of server-generated html: search engine searchability, hide views based on authorization. otherwise, we have abandoned it for pure ajax ui. –  Neil McGuigan Oct 1 '12 at 17:45
I have also abandoned JSF in favor of AngularJS + RESTful backend. (Apples and oranges, but Angular is so nice I don't need many of the benefits of JSF) –  arg20 Nov 16 '13 at 3:53
add comment

6 Answers

up vote55down voteaccepted
JSF to plain JSP/Servlet/HTML/CSS/JS is like as jQuery to plain JS: do more with less code. To takePrimeFaces as an example, browse through its showcase to see complete code examples. RichFaceshas also a showcase with complete code examples. If you study those examples closely, then you'll see that you basically need a simple Javabean class as model and a XHTML file as view.
Note that you should not see JSF as replacement of alone HTML/CSS/JS, you should also take the server side part into account (specifically: JSP/Servlet). JSF removes the need of all the boilerplate of gathering HTTP request parameters, converting/validating them, updating the model values, executing the right Java method to do the business stuff and generating the HTML/CSS/JS boilerplate code. With JSF you basically end up with a XHTML page as view definition and a Javabean class as model definition. This greatly speeds up development.
As with every component based web MVC framework, you have in JSF less fine-grained control over the rendered HTML/CSS/JS. Adding custom JS code isn't that easy as you have to take the JSF view state in the server side into account as well (e.g. enabling a disabled button in JS side won't enable the button in JSF side, which is in turn a huge security advantage). If that is however a major showstopper, then rather look for an action based web MVC framework like Spring MVC. You'll only take into account that you have to write all that HTML/CSS/JS code yourself. Also if you fall back from Facelets to JSP, you'll miss advanced templating capabilities as well.
On the other hand, if you have a big JSP/Servlet/HTML/CSS/JS/jQuery based website and you'd like to refactor the repeated JSP/Servlet/HTML/CSS/JS/jQuery boilerplate code into reusable components, then one of the solutions would be JSF. Custom templates, tagfiles and components can aid in this. In that perspective, JSF stands above JSP/Servlet/HTML/CSS/JS/jQuery (and that's also why it's pretty important to understand those basics before diving into JSF).

See also:

share|improve this answer
Do more with less code? But with more xml... what a tradeoff... additionally, it robes you of flexibility – Łukasz L. Nov 25 '11 at 13:41
In JSF 2.0+, xml is not necessary. –  Cagatay Civici Nov 26 '12 at 14:23
add comment
JSF was created to make it so that java shops didn't have to learn stuff like jQuery and buil complex js but instead focus on a purely Java stack. In a world where time is money and lots of places already focusing on Java development, one less language/piece in the stack makes training and maintaining faster and thus cheaper.
I'll add that JavaScript is easy to become a maintenance nightmare on large teams, especially if some of the developers on the project are not highly web savy.
share|improve this answer
So if am pretty comfortable with JQuery JS etc. I need not be concentrating on JSF? –  sushil bharwaniDec 12 '10 at 14:10
It all depends on the problem you are trying to solved and what team you are solving it with. –  Andrew WhiteDec 12 '10 at 15:15
I agree on team, but i am interested in learning what different problems can JSF solve and js jQuery etc cannot. Just trying to buildup motivation to learn JSF. –  sushil bharwani Dec 12 '10 at 15:33
None, it just provides a different way to solve the same problems. –  Andrew White Dec 12 '10 at 16:18
Even if you're really comfortable with JQuery, JSF is still really useful. It provides an easy way to connect server side code to client side representations. Some Facelets 'composite components' are only a rather thin wrapper around HTML and JS (including JQuery). They're a breeze to build and in general just make the whole client-server side connection way easier. –  Arjan Tijms Dec 13 '10 at 23:15
add comment
With Javascript and frameworks such as jQuery you have full flexibility and full control . Wwith ext's etc you lose much control and must adapt to the framework. With JSF you totally lose control and must totally adapt to the framework. You're invoked in lifecycles etc. and finally you have no control when the call to the server can be made and where not. If you are to do something considered 'special', you're in very hard position. And in JSF world even such basic things as multicolumn table sort or fields where you can type only limited set of characters (such as number field) are considered 'special'.
However, the more flexibility you have, the more errors or bad practices you can made. High flexibility works only with highly intelligent programmers, others will turn the project into unmanagable nightmare.
But, with JSF and its limited flexibility, there's always only a few (or even only one) correct way to do something. You are very limited, you can't make shortcuts, you must write more XML etc. - but when adapting to standard, there's better control on the code the unexperienced or low-skilled programmers will produce. As a result, big corporations love JSF because it is 'safer' for them.
When I moved from GWT to JSF, I was shocked, how many things, that was natural to me, was considered highly untypical and how much simple things were so hard to achieve. What's more, even making the smallest changes, such as adding ':' sign after label, which in GWT/jQuery powered app would be changing one function generating label, required changing dozens of files with localized properties, which wasn't even considered by anyone except me strange...
share|improve this answer
PrimeFaces is based on jQuery so you have lots of flexibility on client side, also PrimeFaces components provide many hooks on client and server side as event callbacks for you to customize. Javascript APIs can be overriden and CSS as well for customized look. : label can be configured globally in web.xml for a more jQuery friendly character. –  Cagatay Civici Nov 26 '12 at 14:26
add comment
I strongly disagree that jsf adds anything. It only adds overhead. Doing ui stuff on the server is the most ridiculous thing ive ever heard. And javascript on large teams works great - its called reusing code.
Just wrap the jquery in some jsp tags, thats all you need and youre done, and dont endure the.shackles and scalability issues with.jsf and richfaces.
share|improve this answer
JSF is geared towards form based applications. jQuery is nice (heck, lot of popular JSF component libraries like PrimeFaces, RichFaces and IceFaces even use it under the covers), but jQuery doesn't simplify processing form submits in the server side in any way. Using plain JSP/Servlet will only result in terrible boilerplate code. Again, JSF is not only HTML/CSS/JS, but also JSP/Servlet. –  BalusC Apr 30 '12 at 17:34
add comment
The benefits of using JSF are not only in generating xhtml + css + js. Sometimes JSF imposes a restriction on the markup you can generate, like any component based framework. But JSF is not just for that, its lifecyle helps greately. After validating the input it can update the model and sync your server side beans without any effort. you just say "whatever the user types here, check if it's a number, if yes then store it in the property YY in object XX" and JSF will do all that.
So yes, you can still use JQuery, JS, etc. But JSF provides many benefits when it comes to writing server side code and saves you from a lot of boiler plate.
share|improve this answer
add comment
Having worked with JSF, Spring MVC, Struts, Grails, JQuery, and ExtJS my opinion is that Grails + ExtJS is one powerful combination.
I would pick Grails over JSF any day. I like the completeness of ExtJS as the client side framework and library, but it comes with a steeper learning curve than JQuery.
share|improve this answer


oakleyses said...

louis vuitton handbags, oakley sunglasses, louboutin, longchamp outlet, nike shoes, louis vuitton outlet stores, chanel handbags, burberry outlet, prada outlet, jordan shoes, tiffany and co, michael kors outlet, tory burch outlet, louis vuitton outlet, longchamp handbags, nike free, true religion jeans, michael kors outlet, kate spade outlet, polo ralph lauren outlet, tiffany and co, prada handbags, polo ralph lauren outlet, michael kors outlet, michael kors outlet, longchamp handbags, oakley sunglasses, ray ban sunglasses, kate spade handbags, burberry outlet, louis vuitton outlet, louboutin outlet, louboutin, coach factory outlet, air max, air max, coach outlet, gucci outlet, christian louboutin shoes, michael kors outlet, coach purses, ray ban sunglasses, michael kors outlet, louis vuitton, coach outlet store online, true religion jeans, oakley sunglasses cheap

oakleyses said...

ralph lauren, lululemon, air max, hollister, north face, nike air max, polo lacoste, vanessa bruno, timberland, vans pas cher, louboutin, louis vuitton, oakley pas cher, air max pas cher, nike roshe run, air max, true religion outlet, barbour, sac longchamp, air force, hollister, sac louis vuitton, nike free, polo ralph lauren, nike trainers, louis vuitton uk, nike roshe, sac hermes, longchamp, michael kors, sac burberry, sac guess, mulberry, new balance pas cher, converse pas cher, sac louis vuitton, hogan outlet, nike tn, north face, true religion outlet, ray ban pas cher, michael kors, air jordan, nike blazer, nike free pas cher, michael kors pas cher, abercrombie and fitch, ray ban sunglasses

oakleyses said...

mac cosmetics, mont blanc, marc jacobs, canada goose outlet, nike huarache, vans shoes, soccer jerseys, hollister, giuseppe zanotti, beats by dre, abercrombie and fitch, longchamp, insanity workout, celine handbags, bottega veneta, ghd, nfl jerseys, north face outlet, chi flat iron, ugg boots, birkin bag, ugg australia, canada goose, herve leger, ugg pas cher, rolex watches, valentino shoes, canada goose uk, canada goose, ferragamo shoes, canada goose, ugg boots, uggs outlet, north face jackets, soccer shoes, asics running shoes, new balance shoes, p90x, lululemon outlet, canada goose jackets, mcm handbags, instyler, babyliss pro, ugg, wedding dresses, jimmy choo outlet, reebok outlet, nike roshe run

oakleyses said...

parajumpers, karen millen, air max, converse, pandora charms, moncler, louboutin, moncler, links of london, lancel, juicy couture outlet, oakley, hollister, pandora charms, supra shoes, thomas sabo, canada goose, gucci, wedding dresses, timberland boots, swarovski crystal, air max, coach outlet store online, moncler, ray ban, canada goose, moncler, ugg, louis vuitton, swarovski, hollister, montre homme, moncler, hollister clothing store, ralph lauren, rolex watches, moncler outlet, moncler, iphone 6 cases, baseball bats, juicy couture outlet, toms shoes, vans, pandora jewelry, ugg, converse shoes

Zheng junxai5 said...

true religion sale
nike uk
celine bags
michael kors outlet online
oakley sunglasses outlet
adidas boost
oakley outlet
coach outlet canada
beats by dr dre
adidas nmd
kobe 8
nike sb janoski
michael kors outlet
adidas originals
coach factory outlet online
coach factory outlet online
michael kors handbags
nike roshe run
tory burch outlet online
oakley sunglasses
coach factory outlet online
coach outlet store online clearances
michael kors outlet
basketball shoes
nike air max uk
tods sale
lebron 12
cheap ray ban sunglasses
coach outlet online
michael kors
jordan retro 11
michael kors outlet clearance
coach outlet store online clearances
air jordan shoes
oakley sunglasses
beats by dre outlet
ray ban sunglasses
oakley outlet
coach outlet clearance

soma taha said...

I love it when folks get together and share opinions. Great site, stick with it!

رضاابو مى said...

شركة مكافحة النمل الابيض بخميس مشيط
شركة مكافة حشرات بالرياض
شركة تنظيف بالرياض الصفرات
شركة الصفرات للتنظيف بالرياض
شركة مكافحة حشرات بالرياض الصفرات
شركة الصفرات للتنظيف يالرياض
شركة الصفرات لتنظيف بالرياض ان شركة وادى الرياض من اكفا الشركات حتى الان اننا نعمل بكل جهد ونشاط لاسعاد عملينا حتى نمتاز عن باقى الشركات اخى العزيز اننا نعمل فى كافة المجلات حتى الان ولا يوجد منافس لدينا لدينا العمالة المطلوبة والصحيحة وكل شىء تجدة انشاء الله عندنا ان هذة الشركة شركة ممتازة وخصوصا فى التنظيف والمكافحة وكشف تسربات المياة ولدينا ايضا شركة نقل اثاث بالرياض ان شركة نقل اثاث بالرياض الصفرات
هى اهم الشركات لدينا ونحافظ على هذة الثمعة على مر السنوات الماضية حتى لايتكلم احد عنها بغير شكل غيرلائق الشركة الرسمية هى شركة وادى الرياض والتى يعرف عنها الكثير والكثير اننا والحمد الله نعمل من اجلك فقط
شركة تنظيف كنب بالرياض الصفرات
شركة الصفرات لتنظيف الكنب بالرياض شركة الصفرات لتنظيف السجاد بالرياض
شركة تنظيف سجاد بالرياض الصفرات
شركة الصفرات لرش مبيدات بالرياض
شركة رش مبيدات بالرياض
شركة تنظيف بالرياض
شركة تسليك مجارى بالرياض الصفرات
شركة رش مبيدات بالرياض الصفرات

عبده العمراوى said...

شركة تسليك مجارى بالرياض