can i use Spring framework for developing JSP application? - spring

I have Eclipse-EE 3.6 IDE...I want to develop a Web Application using JSP and Servlet.
I plan to develop this application using Spring framework.
is it possible...can i use Spring framework for developing JSP application?
can you provide some Tutorials for JSP Application development using spring for beginners.

You can use Spring MVC. Try following tutorials:
http://static.springsource.org/docs/Spring-MVC-step-by-step/
http://www.vaannila.com/spring/spring-mvc-tutorial-1.html
http://maestric.com/doc/java/spring
Thanks.

Yes, you can. JSP is a standard view technology for spring-mvc. I'd recommend the official spring-mvc documentation

Yes, I would say, that this is one of the most done use case for Spring.
Anyway: I strongly recommend to use STS (SpringSource Tool Suite), it is free and based on Eclipse 3.6 Java EE, but provides additional Spring features. For example the some templates for Spring Projects (new Project/SpringSource Tool Suite/Spring Template Project).
And one very interesting Feature: Task Base Tutorials. They are great if you want to lern form an example: Dashbord/Tutorials/

Related

Spring MVC vs Java EE

So I'm about to learn Spring MVC. But what I don't understand is why should I use Spring MVC if I can implement the MVC pattern using a single servlet conroller and JSPs? What advantages does Spring MVC provide over simple java MVC pattern?
Actually yes, you can do it. Question is if you should do it. Spring MVC gives you better organization of your code.
Pure MVC Frameworks like Spring MVC are obsolete today. When combined with templating engines like Thymeleaf, it lacks functionality and developers usually reinvent JSF. For single-page apps based on some popular JS frameworks that need REST backend, JAX-RS is way cleaner and better than Spring MVC REST.
So no, today you don't need Spring MVC and can stick with pure Java EE. For simple, toy-like applications where servlets are enough, you don't really need it but it may be better to use it. For anything serious, MVC is outdated and Spring has nothing to offer.
Edit 2017: Spring offers JAX-RS integration. However, it has several pitfalls, for example Spring won't automatically register classes annotated with #Path for you. Details can be found in Dzone Article
The best way to realize that it's better to play with these technologies for yourself, if you want to try spring MVC I recommend you start with spring boot because you can create projects with more agility without configuring xml files
Spring Boot
Some Features
Create stand-alone Spring applications
Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
Provide opinionated 'starter' POMs to simplify your Maven configuration
Automatically configure Spring whenever possible
Provide production-ready features such as metrics, health checks and
externalized configuration
Absolutely no code generation and no requirement for XML configuration
One of the ideas applied in Spring (not invented by Spring) is
Do not reinvent a wheel.
Having a single controller is not a good idea I'd say - breaking separation of concerns principle.
You can learn more about MVC from Spring documentation.

what is difference between spring framework and spring roo

Can anyone clarify what are the differences between Spring Framework, Spring ROO, and Spring MVC ? I am really puzzled by these similar terms and cannot mangage find an answer.
It's really easy:
Spring Roo is a DEVELOPMENT-TIME tool, similar to Eclipse, IntelliJ, etc.
Spring Framework is a RUN-TIME framework.
Applications generated with Spring Roo at development time use Spring Framework at run time.
Hope this helps.
I do not want to be rude, but also from SO tags we know:
spring
The Spring Framework is an open source framework for application development on the Java platform. At its core is rich support for component based architectures, and it currently has over a dozen highly integrated modules.
https://stackoverflow.com/tags/spring/info
spring-mvc
Based on the Model-View-Controller (MVC) pattern, Spring MVC helps you build web-based applications that are flexible and decoupled from the underlying view technologies.
https://stackoverflow.com/tags/spring-mvc/info
spring-roo
Spring Roo is a lightweight tool aimed at developer productivity. Via an intuitive command line interface it supports operations such as Java web project creation, persistence configuration and view scaffolding. Roo creates a Java web project that uses the Spring framework, and leverage some best ...
https://stackoverflow.com/tags/spring-roo/info
My own brief description would be: Spring framework is the framework providing some functionalities for example dependency injection. Spring MVC is for creating web projects as you mentioned already. Finally Spring Roo is a tool, that helps you increase productivity, I'd say that instead of manual configuration changes you are using this tool.
Hopefully, this was not too brief...

Whats the difference between Spring and Spring MVC?

I know this is not a programmatic questions.
I am a n00b to this area coming from Java EE background and could not find the difference between the two online (may be I am not a good surfer)
Could someone please share the info?
Spring is a framework alternative to Java EE with three parts:
Dependency injection
Aspect oriented programming.
Libraries for web MVC, persistence, messaging, etc.
Spring MVC is for web MVC. It's one of the many libraries built into Spring. You can use other alternatives (e.g. Struts, SEAM, etc.) if you wish and still use Spring.
spring is enterprise framework designed to solve all your problems for enterprise applications. At present they call it as Spring IO, which can be found at spring.io website.
However, Spring MVC is a framework part of the whole stack available to solve the enterprise solutions. This is framework for writing web applications.

Can a simple JSp and servlet code be migrated to Spring framework?

I am a newbie in web development. I'm using servlets and JSP for web development.However, I've learnt lately that Spring Framework is apt for that which incorporate servlets, jsp etc. So, my question is that can I now run my program using Spring framework ? Like, I have 2 jsp codes, and 1 servlet class. So, how can I migrate the code in Spring Framework ? what additional things or codes do I need to maintain ?
Migrating an existing J2EE project is easy.
You will get rid of a lot of "boilerplate" code in the process. The easiest way to do it in my opinion will be to use SpringToolSuite.
Import your project in STS and then add "Maven" nature to it. In the pom configuration you can edit all the jars that you need and mention the spring framework. Once all this is setup it will be just a matter of minutes to change the code if it is small.
You can follow these video tutorials about maven and spring to learn about it.
JavaBrains
There are more tutorials by "New Circle training" on youtube for the same.
I would also recommend you to read Spring in action 3rd edition-Manning
This book is a must and the best way to learn spring framework. Hope this helps

Can we use Spring MVC Framework and other components of Spring framework (like AOP) together?

I am new to Spring. Just having basic understanding of it.
I am curious to know, can we use Spring MVC Framework and other components of Spring framework (like AOP) together?
Thanks!
Briefly yes.
quote
Spring could potentially be a one-stop shop for all your enterprise applications, however, Spring is modular, allowing you to pick and choose which modules are applicable to you, without having to bring in the rest. You can read details about modules available in Spring Framework.Here

Resources