Reputation: 101
I sometimes wonder what is the difference between JSP and Spring?
These are used for to server. Right?
Spring is a Framework and JSP creates Java Servlets?
I know this, but I do not know to distinguish them?
Upvotes: 6
Views: 11169
Reputation: 11265
As defined by Wikipedia:
The Spring Framework is an application framework and inversion of control container for the Java platform.
Now, to be honest, that is a lot take in, the part that you need to focus on at this stage is Spring is an application framework.
What does "application framework" mean? Also, from Wikipedia:
an application framework consists of a software framework used by software developers to implement the standard structure of application software.
In other words, an application framework provides a structure or flow for programmers to follow when coding an application.
Now that is great BUT how does this relate to JSP?
There are a lot of ways to use the Spring framework, a common use is web applications. Spring provides the Spring MVC implementation for this.
Spring MVC, implements the Model View Controller (MVC) application pattern.
And JSP, Java Server Pages, is a View technology. That is the way the framework serves views towards the client's browser.
So when asking what is the difference between, JSP and Spring. The question is a bit like asking what is the difference between a car and a wheel? Spring is the "frame the car is built-in" and the wheel is a specific part.
In short: Both technologies are used in creating an application, Spring provides the flow, and JSP provides the way we represent our web page.
Upvotes: 23