DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Flask vs. Django: Which Python Framework to Choose?
  • Get to Know JSF: An Easy and Straightforward a Jakarta Framework
  • Top 5 Java Frameworks for Web Application Development
  • Cookies Revisited: A Networking Solution for Third-Party Cookies

Trending

  • Java's Quiet Revolution: Thriving in the Serverless Kubernetes Era
  • Evolution of Cloud Services for MCP/A2A Protocols in AI Agents
  • Event-Driven Architectures: Designing Scalable and Resilient Cloud Solutions
  • Recurrent Workflows With Cloud Native Dapr Jobs

JSF Versus JSP: Which One Fits Your CRUD Application Needs? (Part 1)

By 
Ana-Maria Mihalceanu user avatar
Ana-Maria Mihalceanu
·
Nov. 06, 14 · Interview
Likes (2)
Comment
Save
Tweet
Share
49.6K Views

Join the DZone community and get the full member experience.

Join For Free

we make decisions every day; everything we say and do is the result of a decision, whether we make it consciously or not. no matter how big or small is the choice, there's no (easy) formula for making the right decision. the best decision is the one you adopt after you approach the situation from as many perspectives as possible and then choose a course of action that seems reasonable and balanced at that time.

this article aims to help those of you that were/are/will be challenged to choose between jsp and jsf for developing a crud application, all the words written inside it being accompanied by valid code snippets and samples.

content of  jsf versus jsp debate consists of the following:


  • overview over the differences between the two technologies
  • architectural differences between applications developed with each of them
  • step by step implementation of an application with jsf/jsp ; the application(s) will be built over the same database and addressing  the same purpose.



requirements:

  • an ide

  • java ee 6.0 or higher
  • maven 2.0 or higher
  • jsf2.0 or higher


differencies between jsf and jsp

javaserver faces (jsf) is a web application framework that is based in java. its main objective is to simplify development integration of user interfaces that are web based. it is a request driven model view controller based on component driven ui design model, which uses xml –view templates or facelet views. requests ran through the jsf are processed by the facesservlet. this component loads the view template that is required, builds a component tree, processes events, and renders the response –which is usually in html.


javaserver pages (jsp) is a java based technology specifically used to help software developers serve dynamically generated web pages (such as html and xml) as well as other document types suitable to the development of interactive web content. it was specifically created in order to provide developers the ability to program  java web applications.

jsf

jsp

jsf is a web application that is used to simplify development integration of web based user interfaces.

jsp is a java based technology used specifically in order to help software developers create dynamic web pages.

jsf contains multiple core features, including, but not limited to, managed beans, a template based component system, and two xml based tag libraries.

jsp must be compiled in java bytecode in order to function properly.jsp must be compiled in java bytecode in order to function properly.

jsf is a framework.
model:backing bean
view:jsf

controller:facesservlet

jsp  is not a request driven model view controller, but jsp is accessed by the  dynamically generated web pages like html or xml.

jsf supports validator and conversion,ajax.

jsp does not.

personal recommendations and observations:

1. learn jsp first, and then jsf; you have to understand the past to see what future holds to you.  jsf is popular within nowadays applications implementations, but make sure you understand the components that make jsf a powerful tool.

2. jsp+servlet are best suited for service-oriented applications  and need to control function of presentation through dispatching requests.

3. jsf and facelet are more appropriate for generating mark-up like xhtml, and generally used for presentation-oriented applications.

4. jsf enables development of an web application with only model objects (javabeans) and views (jsp/xhtml pages).


5. in a jsp/servlet  application the following will be necessary : a lot of code to control, preprocess, postprocess, gather data, validate, convert, listen, etc the http request and response.

architectural  overview of applications developed with jsf and jsp

as a developer, before you start coding, you are responsible to examine the ways in which you can design the project. specifically, you need to outline the responsibilities among functional components, and determine how they will interact with each other. as stated in the previous topic, both jsf and jsp have in common a the mvc (model-view-controller) paradigm so let's examine how an application that uses it is looking for each of them.


adopting the mvc design pattern  for your application based on jsp (and not only) provides you with the following benefits:



  • separation of design concerns : because of the decoupling of presentation, control, and data persistence and behavior, the application becomes more flexible; changes  to one component have minimal impact on other components. new views can be created without needing to rewrite the model.
  • more easily maintainable and extensible code : good structure can reduce code complexity. as such, code duplication is minimized.
  • promotes division of tasks : developers with different skill sets are able to focus on their favorite skills and collaborate through clearly defined interfaces.


when using javaserverfaces2.0 or higher,  a request-response cycle goes through six lifecycle phases ( according to specifications), defined as follows:


  • create or restore view : restores or creates a server-side component tree (view) in memory to represent the ui information from a client.
  • apply request values : updates the server-side components with fresh data from the client.
  • process validations : performs validation and data type conversion on the new data.
  • update model values : updates any server-side model objects with new data.
  • invoke application : invokes any application logic needed to fulfill the request and navigate to a new page if needed.
  • render response : saves state and renders a response to the requesting client.
Web application Application framework

Opinions expressed by DZone contributors are their own.

Related

  • Flask vs. Django: Which Python Framework to Choose?
  • Get to Know JSF: An Easy and Straightforward a Jakarta Framework
  • Top 5 Java Frameworks for Web Application Development
  • Cookies Revisited: A Networking Solution for Third-Party Cookies

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!