I have to create some project in Spring MVC. I had not gone through this before and want some help related to the codes. Before that I need some explanation on how this entire framework and what are the benefits of using this same.
I have to create some project in Spring MVC. I had not gone through this before and want some help related to the codes. Before that I need some explanation on how this entire framework and what are the benefits of using this same.
Spring MVC is a integration of the DispatcherServlet. Spring - MVC is one of the modules of the Spring Framework and as its name indicates implements an architecture Model - View - Controller whch are used on the a basis for developing web application. If you have worked with Struts Framework which also implements an MVC architecture before then you will not have many problems in using this module.
If you can understand the form of a web application then this is a bit easier job for you. You might be using JAVA surely and you will need a application server like Tomcat with it. I will at start recommend you to begin with Tomcat. Start with a small project like hello world so that you can get overview of how it works. You can use a small script which I had mentioned and it is a kind of dynamic web a welcome file, index.jsp. Remember that this is shown in the web.xml of the welcome file list. To deploy the same on your application server you have to set it as following <URL_Application_Server> / helloworld i.e. hppt://someurl/helloworld. Then you have to set the libraries of Tomcat first. Just right click > Properties > Java Build Path> Libraries tab > Add Library > Server Runtime > select the application server (Tomcat). Now add the libraries you need to use Spring - MVC.
According to me Spring MVC is very flexible. The reason is that is implements the entire structure using Struts interfaces and there is no need to have specific classes inherit from both their Actions and in its Forms. In addition, all parts of the framework are configurable via the interface pluggin, although Spring provides concrete classes as an option for implementation. Spring MVC also provides interceptors that allow controllers to factor common behavior in the handling of multiple requests.
I can list you some advantage of Spring MVC. This will be helpful to you to understand the usage. First Spring MVC provides you a clean division between Controllers, Models (JavaBeans) and Views. This is important for a framework to run the scripts. The controllers are configured via IoC like other objects, which makes you easily testable l and integrated with other objects that are in the context of Spring, and therefore manageable by it. Spring Web layer is a small part at the top of the Spring business layer, which seems a good practice. Struts and other web frameworks leave your choice to implement the business objects, while Spring provides a framework for all layers of the application.
Spring has a well defined interface to the business layer and it offers a better integration with technologies other than JSP, as Velocity, XSLT, Freemake and XL while struts requires extending the Action class, while not Spring MVC, but provides a number of implementations of Controllers for the user to use them.
If we go for comparison with Struts 1.x then you will not really find a good option here. I like the version 2 which is much more modern in the use of POJO, interfaces, etc. Spring MVC allows you to remove the navigation of XML which is an advance, but does not reach the level of Ruby.I have used Struts 1.2 and I think is pretty good despite the thousands of criticism is always done. I have not used Spring, but I'm about to go into the matter. The problem with frameworks is that never, ever be 100% tailored to the developmental needs of each application. Frameworks give us many facilities, but they are not miraculous.
If you want to program yourself Spring maybe can makes it easier than the thing. However, if you want to use an Ajax library for Java as Ajax4jsf most options in this field are scheduled for JSF. That's my experience if you find a library for Spring MVC I would like to know about it.
I have not used Spring MVC. But if I have used Struts. In the version 1.x and 2.x currently at version From what I see in this comparison compare Spring with Struts 1.x Since Struts 2.x solves many of these differences. Take a look at Struts 2 that is based on WebWorks, that if it is a product for my taste is not mature enough so it has some bugs and also the documentation leaves much to be desired.
Bookmarks