users@javaserverfaces-spec-public.java.net

[jsr344-experts mirror] Re: JSF MVC?

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Sun, 2 Mar 2014 00:03:50 +0100

Hi,

On Sat, Mar 1, 2014 at 9:57 PM, Adrian Gonzalez <adr_gonzalez_at_yahoo.fr>wrote:
>
> But HTML5/JS and REST services being the hype of today, I don't know if
> there's many users interested in an action-based framework (even if IMO
> it's usefull to have this choice - being able to build simple applications
> with a simple technology ;) ).
>

According to the Java EE 8 survey it did seem users were somewhat
interested. See
https://java.net/downloads/javaee-spec/JavaEE8_Community_Survey_Results.pdf

60.8 procent said they were interested.



> Both JAX-RS and JSF miss some features for a MVC framework.
> JSF misses (at least) the following stuff to support reasonably well the
> MVC scenario :
> 1. it doesn't support for now HTTP REST usage : HTTP PUT, POST (without
> postback), DELETE, etc...
> This is a blocker.
>

I guess this could be added. Note that JSF does implicitly works with POST
without postback. It will just see it as a non-faces request and things
like view parameters do work with POST request parameters.

I do think that the term "MVC" has undeservedly been given a very specific
meaning here. JSF already IS an MVC framework and I'm also not sure that
REST is part of the official definition of MVC. The concept of MVC pretty
much pre-dates the web, and REST wasn't around then ;)

But I do recognize that many people now seem to think that MVC is basically
"the way Spring MVC does things", but this is IMHO not correct. JSF as it's
now has a model, a view and a controller just as well.



  2. templating : plugging in a 3rd party templating engine easily should
> be supported in MVC.
> ASP.NET MVC supports this kind of pluggability (see
> http://stackoverflow.com/questions/1451319/asp-net-mvc-view-engine-comparison
> ).
> I'm not sure if plugging another templating engine with JSF is easy.
>

JSF was pretty much build with this pluggability in mind ;) Via its VDL
(View Definition Language) you can plug-in any alternative engine. Don't
forget that Facelets was an independent templating engine before it became
adopted by JSF. I prototyped one based on pure Java once. See
http://jdevelopment.nl/authoring-jsf-pages-pure-java



Personnally, I would have expected to use JAX-RS as a starting point for an
> action based framework.
> If JSF is used as a base for an MVC framework, it would need to duplicate
> JAX-RS @Path @PathParam, @HttpMethod, @GET, @POST, ...
>

Another way to look at this might be that those kind of annotations should
maybe be moved to the Servlet specification or another individual spec?



As I recall, Spring MVC has been built after JAX-RS. Spring MVC authors
> didn't used JAX-RS because it was too limiting for them .
> Perhaps someone should ask them why JAX-RS was too limiting in order to
> lift those limitations ?
>

I'm not sure this was the case. After al Spring MVC is from late 2004 (see
e.g. http://devx.com/Java/Article/22134), while JAX-RS didn't appear until
2008.




> Some experimentations related to MVC usage :
> [...] * JAX-RS and templating engine :
> https://jersey.java.net/documentation/latest/mvc.html
>

In the discussion I linked in my previous post this one was discussed.
Personally I'm not a big fan of that approach, as it would mean Java EE
would ship with two distinct competing web frameworks. I know the Jersey
guys say it's just a small addition to JAX-RS, but I'm afraid it will give
a very confusing signal to end users.

The last few releases of Java EE have been about integrating technologies.
Bean Validation integrates very nicely with JSF and JPA, CDI scopes
integrate with EJB and CDI beans integrate with Expression Language and
thus with Facelets and JSF, etc etc. I don't think singling JSF out in this
regard will help with the integration theme.

Kind regards,
Arjan


  ------------------------------
> *De :* arjan tijms <arjan.tijms_at_gmail.com>
> *À :* users_at_javaserverfaces-spec-public.java.net
> *Envoyé le :* Vendredi 28 février 2014 23h14
> *Objet :* [jsr344-experts mirror] JSF MVC?
>
> Hi there,
>
> Many of you have undoubtedly read Manfred's blog about the action based
> prototype in Mojarra. For those who haven't yet, it's at
> https://weblogs.java.net/blog/mriem/archive/2014/01/13/jsf-tip-56-using-action-based-prototype-mojarra
>
> This very same prototype is now also referred to as one of the 3 possible
> options in part 3 of the Java EE 8 survey concerning "An additional web MVC
> framework".
>
> From the previous part of the survey it became clear that people are
> interested in the action based topic, but that there's no clear consensus
> whether this should be an upgraded JAX-RS, the standardization of Spring
> MVC or something else. That something else might thus just as well be an
> upgraded JSF (as I argued for last year here:
> https://java.net/projects/javaee-spec/lists/users/archive/2013-10/message/5
> )
>
> I thus wonder what everyone's opinion is about this prototype Manfred
> created.
>
> Clearly it's a prototype. Things like parameter injection have not been
> added yet and some (core?) details like how to exactly identify request
> parameters submitted by existing components have not been entirely fleshed
> out yet.
>
> But, do you think this is the way forward for JSF?
>
> Kind regards,
> Arjan Tijms
>
>
>
>
>