Skip to main content

2015 | OriginalPaper | Buchkapitel

3. Spring MVC

verfasst von : Iuliana Cosmina

Erschienen in: Pivotal Certified Spring Web Application Developer Exam

Verlag: Apress

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

This chapter was written with the intention of teaching a developer how to create a simple Spring web application and understand how the background plumbing can be modified according to the desired approach. Think of Spring infrastructure components as LEGO pieces. You can connect them in different ways to get the final result: a working web application. After going through this chapter, you should be able identify and use the main components of Spring MVC to create a web application in a few easy steps.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Fußnoten
1
Thymeleaf is the new sheriff in Web town. It is an XML/XHTML /HTML5 template engine that works both in web and non-web environments. It is really easy to integrate it with Spring. If you want to read more about it before using it in the practice code for this chapter, go to the official site at http://www.thymeleaf.org/ .
 
2
If it looks as if Spring MVC resembles Struts, you are definitely not imagining things. The Spring Web MVC was inspired by Struts, which was one of the first MVC-based frameworks. The DispatcherServlet in Spring has the same responsibilities as the ActionServlet in Struts, as both are implementations of the Front Controller Pattern. You can read more about this software design pattern at http://www.martinfowler.com/eaaCatalog/frontController.html .
 
3
If you want, you can look in the API documentation for detail information about this class, which is available at http://docs.spring.io/spring/docs/current/javadoc-api/ .
 
6
The full list of configuration options for Gretty can be found at http://akhikhl.github.io/ gretty-doc/Gretty-configuration.html .
 
10
By default, strategies for checking the extension of the request path and the Accept header are registered. The path extension check performs lookups through the ServletContext and the JavaBeans Activation Framework (if present) unless media types are configured. In order to use the JavaBeans Activation Framework, the activation.jar has to be in the classpath of the application.
 
11
A detailed explanation of exception handling using Spring MVC is at https://spring.io/blog/2013/11/01/ exception-handling-in-spring-mvc .
 
12
A RESTful URI identifies a domain resource (like a book, or a person, in this case) rather than an application resource like a web page or a form. URI is the acronym for Uniform Resource Identifier. URL is the acronym for Uniform Resource Locator. REST services work only with URIs and @PathVariable.
 
13
More information about it is at http://mockito.org .
 
14
Read more about it on the official site at http://hamcrest.org/ .
 
16
This approach is described by the Composite View pattern that introduces the notions of composite and atomic views. A composite view is a tree structure of atomic views. An atomic view can be included dynamically and it changes based on the context.
 
17
Detailed API information on tiles:insertAttribute is at https://tiles.apache.org/framework/tiles-jsp/ tlddoc/tiles/insertAttribute.html .
 
18
Detailed API information on tiles:importAttribute is at https://tiles.apache.org/framework/tiles-jsp/ tlddoc/tiles/insertAttribute.html .
 
20
Adam Bien, one of the most respected Java developers in the world, has named DTOs objects “anemic in general and do not contain any business logic” on his blog at http://www.adam-bien.com/roller/ abien/entry/value_object_vs_data_transfer .
 
22
In the PErsonal REcords Manager project, because Spring DATA JPA is used, the implementation of the repositories API is reduced to interfaces extending the JpaRepository interface. They are placed in the logic tier/service layer.
 
Metadaten
Titel
Spring MVC
verfasst von
Iuliana Cosmina
Copyright-Jahr
2015
Verlag
Apress
DOI
https://doi.org/10.1007/978-1-4842-0808-3_3

Premium Partner