• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF vs JSP + Servlets

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I would like to ask about the comparison between using JSF and using JSP + Servlets , Why should I favor one of the two technologies over the other?

 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The advantage of JSP+Servlets is that you can construct your webapps any way you want.

The disadvantage of JSP+Servlets is that you must do all the constructing. And debugging - not only of the app, but of whatever framework you develop to support the app. And there won't be any better documentation available for said framework than what you create. Management won't be able to send a temp programmer down to the bookstore to buy a book documenting your framework.

JSF provides a ready-made framework based on the Model/View/Controller (MVC) paradigm that's part of the JEE standard specification and built into JEE-compliant webapp servers. You define the Models (backing beans) and the Views (via View Template files, .xhtml). JSF provides all the Controllers for you, so you don't have to write them. JSF's controllers copy data values from Models to Views and back again, validate input data and report failures, and invoke actions. All of which are very common tasks, so that's much less coding and debugging that you need to do. It does it on a POJO-based architecture so that you don't have to write much code that's JSF-specific, which makes it easier to re-use stuff in non-JSF environments as well as test it offline without the delay and overhead of launching an web application container.

JSF does its best when working with HTML forms. It's at its worst when people attempt to force it to output non-HTML content such as PDF's or Excel spreadsheet files. Fortunately, JSF doesn't require itself to totally own the web application, so it's perfectly acceptable to mix-and-match, using JSF to handle the forms and straight servlets/JSPs for non-HTML work and use mechanism such as session-scope objects to communicate between the different modes.
 
Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic