Questions tagged [spring-mvc]

A framework for building Java web applications based on the Model-View-Controller (MVC) pattern. It promotes flexible and decoupled code from the underlying view technologies.

Spring MVC is an action-based (as opposed to component-based) web framework built on top of the Spring IOC Container. MVC stands for Model View Controller, a long standing design pattern that layers an application separating presentation concerns from business logic see Portland Pattern Repository's MVC Entry

The latest stable version is 5.1.4 and was released in January 2019, and the current docs can be found in the MVC section of the Spring Reference.

Spring Version 5.0 fully supports Java 9 features, this release now requires Java SE 8.

Major Spring Releases

  • First Release : Year 2004
  • Spring 2.0 : Intoduced namespaces and support.
  • Spring 2.5 : Anotation Based Configuration
  • Spring 3.0 : Strong Java 5+ foundation across framework, Introduced @Configuration model
  • Spring 3.2 : Java Based Configuration introduced
  • Spring 4.0 : Java 8 Support, removed Deprecated classes.
  • Spring 5.0 : Java 9 Support, reactive programming support

The Spring Framework comprises several modules that provide a range of services:

  • Inversion of Control container: configuration of application components and lifecycle management of objects, done mainly via dependency injection
  • Aspect-oriented programming: enables implementation of cross-cutting routines
  • Data access: working with relational database management systems on the platform using and object-relational mapping tools and with databases
  • Transaction management: unifies several transaction management APIs and coordinates transactions for Java objects
  • Model-view-controller: an HTTP- and servlet-based framework providing hooks for extension and customization for web applications and RESTfull web services.
  • Remote Access framework: configurative RPC-style export and import of Java objects over networks supporting , and HTTP-based protocols including web services ()
  • Convention-over-configuration: a rapid application development solution for Spring-based enterprise applications is offered in the module
  • Batch processing: a framework for high-volume processing featuring reusable functions including logging/tracing, transaction management, job processing statistics, job restart, skip, and resource management
  • Authentication and authorization: configurable security processes that support a range of standards, protocols, tools and practices via the Spring Security sub-project (formerly - Acegi Security System for ).
  • Remote Management: configurative exposure and management of Java objects for local or remote configuration via .
  • Messaging: configurative registration of message listener objects for transparent message-consumption from message queues via , improvement of message sending over - - standard APIs
  • Testing: support classes for writing unit tests and integration tests
58288 questions
18
votes
4 answers

Adding ContextLoaderListener to web.xml in Spring MVC

I am new to Spring MVC. I have a web application. I have the following configuration: list.html spring
user1016403
  • 12,151
  • 35
  • 108
  • 137
18
votes
6 answers

Can I find the URL for a spring mvc controller in the view layer?

I think what I need is called reverse url resolution in Django. Lets say I have an AddUserController that goes something like this: @Controller @RequestMapping("/create-user") public class AddUserController{ ... } What I want is some way to…
Vasil
  • 36,468
  • 26
  • 90
  • 114
18
votes
3 answers

can anybody explain me difference between class level controller and method level controller..?

I am new to spring framework....while searching on google..I found few examples which has @RequestMapping annoted at the class level and few examples showing it at menthod level When to use class level RequestMapping and menthod level RequestMapping…
JOHND
  • 2,597
  • 6
  • 27
  • 35
17
votes
1 answer

How to show all controllers and mappings in a view

I have a none standard Spring MVC project. Responding with XMLs. Is it possible to create a view (jsp page) showing all controllers, mappings and parameters that are accepted (required and not). Based on answer,I have: @RequestMapping(value=…
mamruoc
  • 847
  • 3
  • 11
  • 21
17
votes
5 answers

Better alternative to Apache Tiles

I'm looking for a framework that is better and easier to use than Apache Tiles (which so far, I have used a couple of times). With Tiles, it seems that when I have 100 actions I need to creates 100 jsp files and create 100 definitions in…
Fixus
  • 4,631
  • 10
  • 38
  • 67
17
votes
4 answers

better way for dynamic forms with Spring?

What I wonder is if there's a easier/better way to handle dynamic forms (adding form items to the dom via js) when using SpringMVC and Spring forms? Imaging having an Invoice object that have many LineItems. public class Invocie { private List…
NA.
  • 6,451
  • 9
  • 36
  • 36
17
votes
6 answers

How to send an Image from Web Service in Spring

I am facing problem while sending an Image using Spring Web Service. I have written controller as below @Controller public class WebService { @RequestMapping(value = "/image", headers = "Accept=image/jpeg, image/jpg, image/png, image/gif",…
Ketan
  • 314
  • 2
  • 4
  • 15
17
votes
1 answer

Access Model attribute in scriptlet

I am using Spring MVC, and in my Controller, I am setting a standard model attribute using: ... model.addAttribute("param", value); ... Now, I wish to access this in a scriptlet (within a JSP). For example: <% Object value = ***.get***("param");…
Saket
  • 45,521
  • 12
  • 59
  • 79
17
votes
2 answers

Rename JSON fields used by MappingJacksonJsonView in Spring

I'm using MappingJacksonJsonView to serialize to JSON a class, however, I'd like to be able to rename some of the fields from the default name based on the getter name. This is because I've to output field names like "delete_url" and "delete_type"…
stivlo
  • 83,644
  • 31
  • 142
  • 199
17
votes
4 answers

What is Handler adapter in spring mvc?

I am beginner in Spring MVC. I didn't understand handler adapters clearly. What is a handler adapter and when do I use adapters?
techsuri
  • 431
  • 3
  • 5
  • 10
17
votes
2 answers

Log user in with remember-me functionality in Spring 3.1

I currently log users in programmatically (like when they login through Facebook or other means than using my login form) with: SecurityContextHolder.getContext().setAuthentication( new UsernamePasswordAuthenticationToken(user, "",…
at.
  • 50,922
  • 104
  • 292
  • 461
17
votes
2 answers

cvc-elt.1.a: Cannot find the declaration of element 'project'

error: cvc-elt.1.a: Cannot find the declaration of element 'project' I am getting this error constantly. Whenever I create a project using maven it starts displaying this error. I have even mentioned the 'maven-war-plugin' under plugin tag and then…
17
votes
1 answer

Special Login with Spring Security

The company where i am currently working has a special kind of authentication process. Indeed, several users can have the same login and password. So, to identify them, in a second time, the user has to give his email. But again, in a few cases,…
rico
  • 1,843
  • 2
  • 24
  • 41
17
votes
4 answers

SpringMVC is not recognizing request body parameters if using PUT

Maybe this is supposed to not work, but at least I'd like to understand why then. I am passing a simple val=somevalue in the PUT body but spring sends back a 400 Bad Request as it does not seem to recognise the val parameter. Similar request works…
Sven Haiges
  • 2,636
  • 5
  • 42
  • 54
17
votes
5 answers

Best way for a Spring MVC web app to detect a brute force attack?

Are there any features specifically in Spring 3.0 MVC that would help implementing detection of a brute force attack on the authentication/login page of a web app?
Michael Volk
  • 171
  • 1
  • 3