MVC with Java EE 6/7 JPA, JTA, EJB3, CDI - jsf

I like REST, JPA, JTA, EJB3, CDI & Co. And I like MVC web frameworks, but interesting ones like Play! are not Java EE.
So, just for fun, would it make sense at all to think about something like:
A servlet that accepts REST style URLs and dispatches to managed controllers that can inject EJBs and so on through CDI
The controllers forward/redirect to simple views that act as templates and can use responsive frameworks like Bootstrap
Or does Java EE imply JSF and really nothing else?

I had a look into this topic, wrote a simple JSF webapp and found some interesting resources.
This answer to a related stackoverflow question nicely explains how MVC maps to JSF: Understanding JSF as a MVC framework
Regarding REST style URLs, prettyfaces looks promising.
JSF has nice templating similar to Apache Tiles, and pages can be very simple using plain HTML and CSS with EL.
So, maybe no need to think about/look for something else than JSF and just use it?

Related

Is there a way to use Struts 2.0 and JSF togather in a web application?

I've been using Struts 1.x for more than 1 year now, and I've been learning about JSF recently. I know both JSF and Struts are different frameworks but I wanted to use Struts as Action framework and JSF as Component framework in my web application. I'm not sure if we can do that, and couldn't find any materials online regarding this.
Suggestions and links are welcome, Thanks in advance
Struts and JSF can be used in a web application, some(or no) changes might be required in the back end but as both the frameworks follow MVC, the "VIEW" tier would be much similar.
As JSF and Struts both have their own advantages, we can use the advantagesof of each combinedly, like ValidationFramework in Struts and JSF components (html components in Struts)
All this I would just only if you have an existing Struts application, can find more detailed information here
though the link talks about older versions, i hope it gives basic information

How to improve the UI of an existing Struts web application?

There is an existing web application created in Struts. There is a need to totally redo the UI. What is the best way to improve the UI? Will intrducing JSF components like PrimeFaces into the existing Struts code be a good idea? Or what are the options available?
It is hard to join Struts with JSF, since those are two different frameworks trying to do the same thing. So, in practice, you'll end-up rewriting your application. JSF pages and JSP (which are used by Struts) have different livecycle, JSF Beans are working in a different way then Struts Actions.
The point is to make use of that what you already have and make your JSP look better. I would choose good JavaScript UI library and rewrite JSP pages using it. ExtJS is a very good, if you want complete solution. If you want to create custom solution looke at jQuery, Backbone and Mustache templating engine.

GWT MVP and JSF at the same time?

If I do a GWT application with a MVP. Can you confirm that I will not have to use JSF? I have understood that JSF is just for MVC application?
MVC and MVP are patterns so they are not aware of any technology such as GWT or JSF. MVP is a variation of MVC.
GWT and JSF are technologies used for browser-based client applications. They have completely separate origins and implementations. The only thing that may relate them is that both aim to offer AJAX-rich browser JavaScript code at the end.
You won't need JSF if you do GWT apps. You may encapsulate GWT application into JSF if you have large JSF application and you want to take advantage of GWT.
GWT is completly seperate from JSF. Thought you could build a site that uses JSF for some parts and GWT for others.

Running spring MVC along side of JSF

I want to write some new functionality in spring MVC, the problem is that the current site is written in JSF 1.2.
It does use spring 2.5 application context, but thats all.
I am thinking i can drop in spring MVC, write a single page in it, and then see what kind of hoops ill have to jump through to be able to have seamless sessions between spring mvc and jsf.
can someone offer some wise words to me about this venture?
The session will not be a problem. It will be the same session, because it's a lower-level concept than JSF and spring-mvc.
The URL mapping of the respective servlets (the dispatcher servlet and the faces servlet) might be a problem. Your faces servlet would be mapped to *.jsf, and then your dispatcher servlet should be mapped to something like /mvc/*
The question remains whether mixing frameworks like that is a good option. I'd rather suggest using JSF everywhere in this project.
If you need some RESTful services, you can use spring-mvc, or you can use some JAX-RS provider, like CXF or RESTEasy.

jsf and page fragment caching

Does jsf 2.0 + facelets supports page fragment caching, something similar to aps page framgent caching
(example this tutorial http://quickstarts.asp.net/QuickStartv20/aspnet/doc/caching/fragment.aspx)
Regards
The answer on your question actually depends on the view technology in question. JSF is a component based MVC framework, not a view technology. JSF usually runs on either JSP or Facelets as view technology.
Both view technologies however doesn't provide an OutputCache like facility out of the box. You would need to create a custom tag/component for this. JBoss Seam has a similar component in the toolbox, the <s:cache>.

Resources