Sorry to ask this question and it may be a duplicate of other similar threads in Stack overflow.Those similar thready does not work in my situation.
I am having a quite
In my opinion, Spring
and JSF
- both could be used just fine. It, of course, mostly depends on your requirements and preferences of using those frameworks.
Spring - it has very nice ways of transactions management, dependency injection, security and many other features, however - plain JSF
does not provide this kind of features out of the box, but JSF has very nice way of rendering views. So these features from both frameworks mixed up together could result in simplicity. JSF has a variety of it's frameworks which are built on it, like:
In my opinion, you could simplify your views development, if you had been using JSF
. JSF has ManagedBean(s), which depending on your configuration serves your requests, like
Spring controllers does.
Actual configuration is pretty straight forward. You need to have:
faces-config.xml
file which contains SpringBeanFacesELResolver:
org.springframework.web.jsf.el.SpringBeanFacesELResolver
Spring applicationCotext.xml
file. Usual spring config, nothing JSF
specific.
Your web.xml
which should look something like this:
contextConfigLocation
WEB-INF/applicationContext.xml
javax.faces.PROJECT_STAGE
Production
org.springframework.web.context.ContextLoaderListener
org.springframework.web.context.request.RequestContextListener
Faces Servlet
javax.faces.webapp.FacesServlet
1
Faces Servlet
*.xhtml
The most pretty cool thing in JSF
is View Scope, which would be lost by default, if you had been using JSF
with Spring
, but definitely you don't want to lose it. This explains how to make View Scope work in JSF
and Spring
integration.
If I would be building some application from scratch, I would choose these two frameworks and integrate them together, but this is just my opinion. Hope this clears some things for you.