0% found this document useful (0 votes)
16 views7 pages

Why JSF Still Matters in 2023

The document discusses why using Java Server Faces (JSF) may not be crazy despite it being considered outdated by some. JSF is a server-based framework that offers advantages like clear separation of layers and easier coupling of application and business logic. The document argues that JSF provides a simpler and more consistent approach than some JavaScript frameworks, especially for combining backend and frontend development.

Uploaded by

h2oo2h
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

Why JSF Still Matters in 2023

The document discusses why using Java Server Faces (JSF) may not be crazy despite it being considered outdated by some. JSF is a server-based framework that offers advantages like clear separation of layers and easier coupling of application and business logic. The document argues that JSF provides a simpler and more consistent approach than some JavaScript frameworks, especially for combining backend and frontend development.

Uploaded by

h2oo2h
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

2024. 04. 29. 7:33 Are You Crazy Still Using JSF!

- Ralph's Open Source Blog

0 4 / 0 9 / 2 0 2 2 BY RA L P H S O I KA

Are You Crazy Still Using JSF!


JSF stands for Java-Server-Faces which is a web technology that is underestimated by
many people. I wonder why is that? And are you actually crazy if you still use JSF? I don’t
think so and I will share some of my thoughts. (To get an impression about the
technology see the Getting Started Blog form Rudy De Busscher.)

Jakarta EE and Java Server Faces 4.0

The Specification
First of all JSF is a specification which is an important advantage over all the other
technologies that JSF is usually compared to. The specification is an open process that
is accompanied by many developers for years to define a general solid standard for web
applications. This specification process has recently taken place in the Eclipse
Foundation, which sets up rules that follow very high quality standards. This is one of
the biggest advantages, as it guarantees that your web application is build on a solid
core. Of course, other web frameworks also have large communities, but often these
are represented by a single company that does not always take the developers into
account. Angular from Google is just one example.

Server Based Framework


But back to JSF. Why is JSF sometimes ridiculed as an outdated technology? I
personally started with JSF in its early beginning in 2001. So it’s obviously an old
technology. And I am an old developer too ;-). In the meantime, many other web
frameworks have evolved. Many of them are based on JavaScript and follow the single
page paradigm (SPA) running in the browser. The idea is to move the application logic
[Link] 1/7
2024. 04. 29. 7:33 Are You Crazy Still Using JSF! - Ralph's Open Source Blog

into the browser to get applications faster. This idea came up at a time when not
everyone was satisfied with JSF and JavaScript took off. Java Server Faces – as the
name implies – in contrast is a server based framework. This means the application
logic is executed on the server. And this is where we have the big difference. At that
time it was a valid argument to reduce the load on the servers. And of course, this
should still be a desirable goal today. But the people who use this as an argument
against JSF are often the same ones who rave about serverless functions. Therefore, I
don’t think we should consider a server-based framework as a stupid idea today.

Self-Contained Microservice
In fact, a server-based web framework offers some advantages. In this way, application
logic and business logic can be easily coupled. This is achieved within Jakarta EE mainly
through CDI, EJB and JPA. These technologies are the backend for JSF components.
Jakarta EE provides a very clear understanding of the separation of layers and JSF fits
seamlessly into this concept. The server-side implementation also hides application
details from the client. In contrast in a JavaScript SPA, large parts of the application
logic are usually unprotected in the browser which can be a security risk in some cases.

So rendering the application logic on the server side makes it more easy for developers
responsible for both – the backend and the frontend part. And this leads to the fact that
applications can be developed faster in many cases. From the point of view of the
microservice architecture, a JSF application corresponds to the principle of the Self-
Contained Services. This is a pattern which is commonly used in microservice
architectures.

Simplicity
Since JSF is often referred to as complex and clumsy, I recently wondered if this is really
true. I migrated one of my [Link] SPA to JSF 4.0 and compared the complexity of the
resulting code. So finally, I would like to show in an example the simplicity of JSF. (Note: I
do not compare JavaScript code with Java here)

In JavaScript Frameworks you typically bind your HTML tags to some code by additional
tagging.

[Link] 2/7
2024. 04. 29. 7:33 Are You Crazy Still Using JSF! - Ralph's Open Source Blog

<!-- [Link] -->


<input type="text"
name="userwebsite"
v-model="userwebsite"
placeholder="enter your website">
Your Website is: <span>{{api}}</span>

The SPA framework resolve the tag (v-model) and place the correct value from your
model written in JavaScript. It also binds the input field to track changes of your model.

The JSF counter part looks not much different:

<!-- JSF -->


<h:inputText value="#{[Link]}"
pt:placeholder="enter your website" />
Your Website is: <h:outputText value="#{[Link]}" />

Here you also bind your model values to input fields or output text. But the code is
executed in Java on the server side which is often equal to your backend code written in
Java also for SPAs.

Ajax is used by JavaScript Web frameworks out of the box. So you usually have no need
to care about it. In the example above the span tag is automatically updated when the
value of the input changes.

In JSF you use also Ajax, but you have more control about how it behaves. You can
simple enclose a part of your page with a f:ajax tag to get the same behaviour:

<!-- JSF -->


<f:ajax>
<h:inputText value="#{[Link]}"
pt:placeholder="enter your website" />
Your Website is: <h:outputText value="#{[Link]}" />
<f:ajax>

Another example is linking. In a JavaScript framework you use again a kind of tagging to
initiate a rendering life-cycle when the user clicks on an element:

[Link] 3/7
2024. 04. 29. 7:33 Are You Crazy Still Using JSF! - Ralph's Open Source Blog

<!-- [Link] -->


<li class="nav-item" v-on:click="showSection('search')">
<label>Search</label>
</li>

The showSection implements some business logic in your JavaScript code and is
responsible for handling data and changing the layout.

JSF is not much different:

<!-- JSF -->


<li class="nav-item">
<h:link outcome="search" >
<label>Search</label>
</li>

The h:link tag loads a new page from the backend named ‘[Link]’ containing
the new layout. All the model binding is handled behind the scene in the backend. For
the user there is no different in behaviour.

So as you can see from the markup, there is not much difference and it is not more or
less complex to write a JSF frontend as it is in JavaScript based Web frameworks.

Conclusion
My personal conclusion is that JSF gives me a clearer and more consistent concept for
writing my code within a framework. Backend logic and application design are
combined in one technology resulting in a pattern also known as self-contained
microservice.

To me, this is a valid concept even for modern web applications. And computing
application logic on the server side is not crazy at all.

With JSF Version 4.0 you will find a modern and well designed Web technology
embedded into the latest Jakarta EE 10 framework.

[Link] 4/7
2024. 04. 29. 7:33 Are You Crazy Still Using JSF! - Ralph's Open Source Blog

ARCHITECTURE

J A K A R TA E E , J S F

9 Replies to “Are You Crazy Still Using JSF!”

J. Domingos
2 7 / 0 9 / 2 0 2 2 AT 1 2 : 3 2 P M

To be honest, I feel the same way to regarding to this topic.

But the hype on Javascript frameworks and clean font and back-end separation may be
the major reason for JSF exodus towards JavaScript realm.

Starting new projects using JSF (or other non Spring framework tech) is considered a
“crazy” move.

Utkarsh
2 6 / 1 1 / 2 0 2 2 AT 3 : 0 1 A M

Jsf like frameworks are facing revival.


Now they are called server driven ui frameworks

querwurzel
2 7 / 1 1 / 2 0 2 2 AT 1 1 : 0 2 A M

The frontend-backend separation is not only about technology but also about developers.
You can stay in JS land while developing rich frontends and are not forced to know Java
Land.

Anyway .. thanks for the blog post, I liked it, reminds me on my studenthood. For simple
views I even just stick with JSPs on my side projects. And server-side rendering has never
died thanks to SEO .. =)

JEE_Developer

[Link] 5/7
2024. 04. 29. 7:33 Are You Crazy Still Using JSF! - Ralph's Open Source Blog
2 5 / 0 7 / 2 0 2 3 AT 9 : 5 8 A M

I think JSF is a great technology, i know it well and never left it. I have not found a single
valid reason for that. I even developed a complete development framework for developing
JSF SIngle Page Application:

[Link]
tabs-f85b9a5f6b94

[Link]
dynamic-radoj%25C4%258Din/?trackingId=zT1jM7TRSPWRZMBm9SSCnQ%3D%3D

Cyper
0 1 / 0 8 / 2 0 2 3 AT 1 0 : 1 2 P M

JavaScript is an universal language whether your background is Java, C#, Golang, Python,
[Link].

JSF is too limited, it’s just for “old” java boy.

Also a designer/front-end guy can pick up javascript/css (or even [Link]) quickly and craft
some beautiful UI framework. It would be a nightmare for them to use JSF.

JEE_Developer
0 7 / 0 8 / 2 0 2 3 AT 8 : 2 4 A M

@Cyper, “JSF is too limited”


– in what way is it limited? I don’t really feel any restrictions. These are pure prejudices,
which have been adopted uncritically.

@”|and craft some beautiful UI framework…It would be a nightmare for them to use JSF.”
– Take look at

[Link]
[Link]

JEE_Developer
0 7 / 0 8 / 2 0 2 3 AT 8 : 3 2 A M

And just to say:


@”JavaScript is an universal language whether your background is Java, C#, Golang,

[Link] 6/7
2024. 04. 29. 7:33 Are You Crazy Still Using JSF! - Ralph's Open Source Blog

Python, [Link].”
-You mean that the backend is actually a rest, right? FYI, JSF can also work with a REST
backend. You need to know things if you want to seriously discuss them

JEE_Developer
0 7 / 0 8 / 2 0 2 3 AT 3 : 0 8 P M

@Ralph, I think you are missed one of my comment….

Ralph Soika
0 7 / 0 8 / 2 0 2 3 AT 1 0 : 3 3 P M

@JEE_Developer, I agree with your comments in total.

And I also read about this trend, @querwurzel mentioned, that javascript is going back to
the server (for good reasons). We call this now “server driven ui frameworks”.

[Link] 7/7

Common questions

Powered by AI

A common misconception about JSF is that it is an outdated technology only suitable for 'old' Java environments and lacks the flexibility of modern JavaScript frameworks. Proponents counter these views by arguing that JSF provides robust, server-side rendering and security advantages, integrates well within the Jakarta EE framework, and aligns with modern practices like self-contained microservices . They also note that JSF simplifies complex application development by coupling UI and backend logic, which is seen as advantageous despite perceptions of its complexity . Additionally, JSF's adaptability to modern architectural patterns like server-driven UI frameworks is highlighted as a strength .

JavaServer Faces (JSF) offers several advantages in web development within Jakarta EE, including its status as an open and solid specification, which means it is backed by a well-defined standard ensuring reliability . JSF is server-based, which keeps application logic on the server side, offering better security by hiding application details from the client compared to JavaScript Single Page Applications (SPAs). It also supports the concept of self-contained microservices, promoting faster development by integrating backend and frontend logic seamlessly through technologies like CDI, EJB, and JPA . Furthermore, JSF provides a straightforward and consistent development approach suitable for integrating complex business logic with UI components .

JSF simplifies development by combining backend and frontend logic within a single technology, which contrasts with JavaScript frameworks where separation often necessitates more complex state management and lifecycle handling by the developer . While criticized for being complex, practical migration examples indicate that JSF code resembles JavaScript frameworks in terms of structure but simplifies server-side integration because business logic runs on the server, reducing exposed complexities on the client-side . This integration allows developers to focus more on application value rather than technical coupling .

Server-based frameworks like JSF enhance security by keeping application logic on the server, thereby reducing exposure of potentially sensitive logic and data to client-side risks. This contrasts with JavaScript SPAs, where application logic is executed on the client-side, increasing the risk of exposure to attacks and unauthorized access . By rendering logic on the server, JSF ensures that only necessary data is sent to the client, minimizing vulnerabilities associated with client-side execution .

A developer might choose to migrate a JavaScript SPA to JSF 4.0 to take advantage of its robust security, consistency in combining backend and frontend logic, and tighter integration with Jakarta EE's backend technologies like CDI, EJB, and JPA . The migration can result in reduced complexity for maintaining business logic due to JSF's server-side execution model, leading to potentially faster development cycles and simplified state management. This approach can be beneficial for applications requiring strong security and close integration of backend processes .

JSF's server-side nature can impact the speed and scalability of web applications by centralizing logic execution on the server, which may result in increased server load compared to client-side JavaScript frameworks, where logic execution is distributed to clients' browsers . However, this centralized model also allows for more controlled scaling strategies and potentially reduces client-side computations, providing an opportunity for optimizing server resources effectively. By handling business logic on the server, JSF can manage complex workflows and transactions without exposing logics to the user's environment, enhancing transactional integrity and reducing latency for critical operations .

Self-contained microservices refer to the design pattern where a service is isolated and handles its own presentation logic, business logic, and data storage. JSF aligns with this architecture by providing server-side UI components that integrate seamlessly with backend logic and data access layers in Jakarta EE, like CDI, EJB, and JPA . This means applications can encapsulate their functionality more fully within a single deployable unit, simplifying maintenance and scalability—key characteristics of microservices .

Modern perceptions of frontend-backend separation impact the adoption of JSF by aligning more closely with JavaScript frameworks that advocate for clear separation of concerns, where the frontend and backend are distinct, often implemented in different technologies . This trend has led to the notion that using an integrated framework like JSF is outdated. However, proponents argue that JSF's cohesive integration between layers and secure server-side rendering cater to specific needs, such as enterprise applications that benefit from strong consistency and shared models between frontend and backend . Despite perceptions of inefficiency, JSF remains relevant for projects where integration and security are prioritized over modular frontend autonomy.

The Eclipse Foundation plays a critical role in the development and specification of JSF by providing a structured environment for the open specification process, which ensures high-quality standards. The organization oversees the collaborative development of JSF, ensuring that its evolution aligns with the needs of the developer community while maintaining a stable and standardized framework . This open specification process distinguishes JSF from other frameworks that are often controlled by a single company, promoting transparent and inclusive development practices .

In JSF, AJAX is used to update parts of a web page dynamically without reloading the entire page, similar to JavaScript frameworks. However, JSF offers more control over AJAX behavior, allowing developers to explicitly define the scope and components of AJAX updates through the 'f:ajax' tag, which encapsulates Java business logic within the same development environment. This is different from JavaScript frameworks, where AJAX functionality is embedded and often requires a separate layer of client-side scripting to manage updates .

You might also like