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.
85
votes
18answers
64k views
Spring MVC 3 and handling static content - am I missing something?
I am developing a webapp using Spring MVC 3 and have the DispatcherServlet catching all requests to '/' like so (web.xml):
<servlet>
<servlet-name>app</servlet-name>
...
77
votes
4answers
35k views
What's the difference between @Component, @Repository & @Service annotations in Spring?
Can @Component, @Repository & @Service annotations be used interchangeably in Spring or do they provide any particular functionality besides acting as a notation device?
In other words, if I have ...
47
votes
14answers
51k views
Struts or Spring MVC or Struts & Spring? [closed]
I need some information to understand design decision:
Is Struts a better choice than Spring MVC? I hear about Strus-Spring-Hibernae combo - Is struts used at MVC layer because its a matured ...
46
votes
3answers
25k views
What's the difference between <mvc:annotation-driven /> and <context:annotation-config /> in servlet?
I am migrating from Spring 2.5 to Spring 3.
They have introduced <mvc:annotation-driven /> which does some black magic. This is expected to be declared in servlet configuration file only.
In ...
44
votes
3answers
26k views
Multiple Spring @RequestMapping annotations
Is it possible to use multiple @RequestMapping spring annotations in a method? Like:
@RequestMapping("/")
@RequestMapping("")
@RequestMapping("/welcome")
public String welcomeHandler(){
...
40
votes
7answers
31k views
Is there a maven 2 archetype for spring 3 MVC applications?
I'm experimenting with the spring 3 MVC framework. Since i use maven 2 to manage my project, i'm searching for a archetype to create a spring 3 MVC application.
38
votes
5answers
14k views
trigger 404 in spring-mvc controller?
How do I get a spring 3.0 controller to trigger a 404?
I have a controller with @RequestMapping(value = "/**", method = RequestMethod.GET) and for some urls accessing the controller I want the ...
35
votes
2answers
41k views
What is @ModelAttribute in Spring MVC? [closed]
Please elaborate on the purpose and usage of @ModelAttribute in Spring MVC.
35
votes
2answers
52k views
Can anyone explain servlet mapping?
I'm trying to write a web application using SpringMVC. Normally I'd just map some made-up file extension to Spring's front controller and live happily, but this time I'm going for REST-like URLs, ...
34
votes
1answer
29k views
How to store session in Spring MVC
What's the best way of storing session related data of a user (like, for example a log of recent actions a user has done) in a Spring MVC (2.5) web application ?
Using the classic ...
33
votes
9answers
80k views
No mapping found for HTTP request with URI [/WEB-INF/pages/apiForm.jsp]
My handler forwards to internalresourceview 'apiForm' but then i get error 404 RequestURI=/WEB-INF/pages/apiForm.jsp. I'm sure apiForm.jsp located in /WEB-INF/pages/
13:45:02,034 DEBUG ...
32
votes
2answers
23k views
How does autowiring work in spring?
I'm a little confused as to how the IOC works in spring.
Say I have a service class called UserServiceImpl that implements UserService interface.
How would this be auto-wired?
And in my Controllers ...
32
votes
6answers
48k views
How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?
I use Ubuntu and Curl installed it. I want to test my Spring REST application with Curl. I wrote my POST code at Java side however I want to test it with Curl. I will post a JSON data. An example data ...
32
votes
13answers
17k views
Alternatives to JSP for Spring MVC view layer
I'm looking to create a new app from scratch and will probably use Spring MVC and possibly Spring Web Flow. The projects created by Spring Roo use Spring MVC and optionally Web Flow. What are some ...
32
votes
2answers
9k views
RESTful Authentication via Spring
Problem:
We have a Spring MVC-based RESTful API which contains sensitive information. The API should be secured, however sending the user's credentials (user/pass combo) with each request is not ...