JSF or JSF with SpringMVC [duplicate] - spring

This question already has answers here:
Using JSF as view technology of Spring MVC
(3 answers)
Closed 6 years ago.
I am having a Project with J2EE that's not very big , i began using JSF and i found it very nice and easy , but by the time i was searching on the internet i found a integration called JSF and SpringMVC , so i am wondering is that a better way to develop application and is it recomanded for me to use it or i'll be doing fine with jsf all alone.
i saw this link
http://www.mkyong.com/jsf2/jsf-2-0-spring-integration-example/

Both JSF and SpringMVC are implementations of the MVC pattern, so using both framework together is not the best design approach. JSF is a component based framework but SpringMVC is a request based. However you can use both together to get benefit of the SpringSecuirty framework if you need security features in your applications. Another advantage from my point of view is you can use Spring IoC features without the need to use EJB and run your application in a normal web container like tomcat.
Finally, it's your decision based on your requirements.

That tutorial is talking about spring+JSF and not springMVC+JSF.
If you don't know anything about spring you should be doing fine JSF all alone.
There is no a better way nor a worse, they are just showing how you can integrate spring with jsf.

Related

What next now that JSF and Spring are breaking up [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I'm working on a JSF/PrimeFaces web application running on tomcat which uses Spring to inject different services based on the deployment context. I was looking at migrating it to JSF 2.3 when I realized JSF 2.3 requires a CDI container yet Spring doesn't implement the full CDI specification and from what I've read, are not going to do so any time soon.
So my question is two folds:
1) how are people out there dealing with this? I've read there might be some workaround to bridge the CDI with Spring? But which bridging solution would you recommend? Is bridging a long term solution and does the bridging have any drawback (none working features for instance)?
2) if JSF is no longer an option, what web front-end technology would you use for a new Spring-based application? back to JSP? templating like thymeleaf? GWT or vaadin? Javascript technologies like reactJS or angular and working with two languages and data model?
Thanks for sharing
My organization used to be on JSF + Spring, but now we are moving toward Spring MVC + Thymeleaf. Using Angular or React with Spring MVC REST is not a bad option either, but Spring MVC + Thymeleaf will be a much more natural fit with much faster onboarding for the Java team.
MyFaces 2.3.x should still work on Spring. However, i'm not sure if this will be possible with 3.x.
If you don't want to drop Spring, you can also add the CDI implementation "Apache OpenWebBeans", which is very very small (between 0,5mb and 1mb).
There are "bridges" available on the web, how to inject Spring beans into CDI beans and vice versa.

Differences between Spring Boot and spring MVC [duplicate]

This question already has answers here:
Spring MVC or Spring Boot [closed]
(5 answers)
Closed 5 years ago.
just starting out learning Spring, could you tell me the main differences between Spring Boot and MVC?
Which one is recommended for a beginner?
Thanks.
Spring MVC is a project within the Spring Framework for implementing the model-view-controller design pattern. It is used to build dynamic (and static sort of) web pages and ReSTful webservices.
Spring Boot is an opinionated way of building Java applications. Using Spring Boot, you can build web applications using Spring MVC as well as other technologies. Spring Boot provides a common set of components and opinions for building whatever application you are aiming at.
If I put my educator hat on, I would recommend starting with Spring Framework sans boot, only because it will help you understand what boot brings to the party. That being said, I never write traditional spring applications anymore, and always use Spring Boot. The speed to market proposition of Spring Boot is why it is the defecto way to build applications today in enterprise, but so much is done for you that if you really want to learn Spring, you will miss out.

Using Spring with JSF/Facelets [duplicate]

This question already has answers here:
Using JSF as view technology of Spring MVC
(3 answers)
Closed 7 years ago.
I would like some clarification on some things.
I have developed a web application in the Eclipse IDE using JSF and facelets (xhtml web pages). Now, my manager told me to re-create this application but as a RESTful web application using Spring.
I did some research on Spring MVC and its DI/IoC features and have a few questions:
I see that Spring offers DI/IoC, does JSF not offer that?
Can you create RESTful web apps in JSF?
Since JSF uses beans just like Spring, what advantage is there to use Spring over JSF?
Are the facelets just the view part of the Spring framework?
Can I use Spring IoC/DI with facelets?
I am starting to think he just wants me to keep the project as is but add the IoC/DI of Spring.
As you can see, I am quite confused on this subject and would like some clarification.
I can understand your confusion. Once I did a project in which I used JSF as front end and Spring MVC as backend.
for you the answer is Yes , You can do inversion of control using JSF by using JSF Beans (for instance managed beans) but you need to keep in mind couple of things.
1: You need to register beans both for JSF and Spring.
2: Its recommneded that you should set same type of scope for this bean in JSF and Spring.
for example: if you are setting request scope for a specific bean in JSF then you should also set Request scope for the same bean in Spring. Only view scope will not be available in Spring but you can write custom view scope which is not big deal
Answer for the part of question Are the facelets just the view part of the Spring framework?
No, you can't say it is part of spring, facelets are handled by JSF but yes , they mostly used as a view part. So when you have a plan to make a application with JSF and Spring then I will interpret it as you are using JSF for front end and Spring for backend.
Restful services using JSF:
Yes, you can make restful service using JSF. here it is very good blog regarding thisRestful web Services in JSF You can also create restful web service in Spring Rest Web Services in Spring

Disadvantages of using JSF+Spring without webflow

in following examples of JSF Spring integration, i can see that the examples makes a normal integration between spring and JSF without using webflow, so is there are any problems or issues when using Spring with JSF without using webflow, and what are the advantages of using webflow with JSF, please advise.
links:
http://www.mkyong.com/jsf2/jsf-2-0-spring-integration-example/
http://www.mkyong.com/jsf2/jsf-2-0-spring-hibernate-integration-example/
In my experience, the decision whether to use WebFlow is based on your UI requirements....and if JSF is in the box, too, the only reason to actually use WebFlow is if you'd have a vast amount of "wizard-like" UI forms whose plumbing could be more elegantly handled by WebFlow (rather than JSF faces-context navigation rules).
The level of pain could also vary between different JSF implementation. For example, we've had nothing but trouble trying to integrate WebFlow 2.0.4 with IceFaces 1.8.2 (which is based on JSF 1.2).
More on that (together with a straightforward explanation on how to integrate JSF and Spring) can be found on this SO thread.

Using Spring MVC with JSF [duplicate]

This question already has answers here:
Using JSF as view technology of Spring MVC
(3 answers)
Closed 7 years ago.
Im using Spring MVC by itself till now, works great, but i hear from friends that JSF is also good, has some good visual stuff, even though i dont really know much bout JSF. So my question is: Is it possible to mix Spring MVC with JSF? If it is, is it a good thing to do or theres a better way to do it?
Try to stick with this equations:
Spring MVC + ORM (hibernate) + JSP + Jquery
or
EJB + JSF + RichFaces
It is definitely possible but with lot of effort. It's better to use spring framework only for the DI for services and DAO layer and use JSF for front end components. You can define two controllers with two different mappings say one with jsf and one with do and forward requests accordingly.
JSF is primarily component based MVC framework and probably the first successful event based web technology (analogous to Microsoft ASP .Net).
One can easily integrate with Spring MVC and it is good approach assuming existing business/web-application has been developed on Spring framework.
It is better to go with JSF2+JDBC(or JPA2) on Tomcat7/JavaEE6 certified servers.
JSF+EJB3.1+EclipselinkJPA or Hibernate JPA/your choice of JPA implementation
JSF+JDBC with or without traditional DAO
(1)EJB3.1+JSF2.1/2.2+PrimfeFaces/Tomahawk/Icefaces. Primefaces is one of the best and most popular JSF implementation; because primefaces has got rich UI components and excellent support from forum and nice examples and documentation, inbuilt JQuery support. Few things would be better in Tomahawk adn Icefaces. With JSF2 you can use more than one JSF implementation (i.e. Primefaces & Icefaces). JSF2 is easily pluggable into JDBC, Spring, and other widely used java web technologies.
(2)Just use JDBC+JSF with or without traditional DAOs for small, medium and large commercial web-application projects; because your application would be more easy to develop and maintain, more portable across tomcat and other webcontainers, no need of JavaEE certified (J2EE app servers) servers.
JSF is MVC and best used as View part of MVC
Integrating Spring MVC and JSF 2.1

Resources