eclipse-ee4j / mojarra

Mojarra, a Jakarta Faces implementation
Other
158 stars 107 forks source link

Feature Request: some examples about Mojarra "Action Framework" and "Rest" #5372

Closed pizzi80 closed 5 months ago

pizzi80 commented 6 months ago

I've found only this article of January 2014

https://www.manorrock.com/blog/2014/01/13/jsf_tip_56_using_the_action_based_prototype_in_mojarra.html

It would be nice to understand the capabilities of these 2 modules

1) How to include the action module with maven 2) How to use the action framework to reaplace an empty view with only f:metadata 3) Why it is better than a Servlet? 4) Is it possible in the future to include the functionality inside the main FacesServlet using an Annotation based action framework

5) How to include the rest module 6) What capabilities has this module? It's a lite version of jersey?

Thanks

PS There are no info about these 2 modules inside the book "The definitive guide to Jakarta Faces..." ;)

BalusC commented 6 months ago

It's not part of Faces spec. It's part of Mojarra impl. So just having the Mojarra dependency is sufficient. The key is setting the jakarta.faces.LIFECYCLE_ID init param of FacesServlet to a custom implementation of jakarta.faces.lifecycle.Lifecycle API.

It's basically just a demonstration that Faces can be transformed from a component based MVC framework into a request based (action based) MVC framework or even a REST web service by simply changing the Lifecycle implementation. As to the REST module, search for a class implementing Lifecycle and you'll figure out what it does as well as its LIFECYCLE_ID.

It was created around the time Java EE MVC (Ozark) was proposed as a new Java EE API for a Spring MVC-like framework under the EE umbrella. This Mojarra "Action Framework" was used to demonstrate that the existing JSF API can also be used to act like (Spring) MVC after simply swapping out the Lifecycle instance by the desired implementation. See also https://www.oracle.com/technical-resources/articles/java/mvc.html. Do note that the original MVC 1.0 didn't made into Java EE 8 on time, so it became a separate library. But it's present in Jakarta EE 10: https://jakarta.ee/specifications/mvc/

BalusC commented 5 months ago

https://github.com/eclipse-ee4j/mojarra/issues/5374