26
votes
5answers
56k views

JQuery, Spring MVC @RequestBody and JSON - making it work together

I would like to have a bidirectional JSON to Java serialization I'm using successfully the Java to JSON to JQuery path... (@ResponseBody) e.g. @RequestMapping(value={"/fooBar/{id}"}, ...
39
votes
14answers
52k views

Who sets response content-type in Spring MVC (@ResponseBody)

I'm having in my Annotation driven Spring MVC Java web application runned on jetty web server (currently in maven jetty plugin). I'm trying to do some AJAX support with one controller method ...
59
votes
2answers
59k views

What is @ModelAttribute in Spring MVC? [closed]

Please elaborate on the purpose and usage of @ModelAttribute in Spring MVC.
116
votes
4answers
56k 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 ...
22
votes
5answers
12k views

What is recommended way for spawning threads from a servlet in Tomcat

Probably a repeat! I am using Tomcat as my server and want to know what is best way to spawn threads in the servlet with deterministic outcomes. I am running some long running updates from a servlet ...
45
votes
2answers
37k 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 ...
10
votes
2answers
6k views

Why DispatcherServlet creates another application context?

I have configured the root application context using ContextLoaderListener and the context init-parameter contextConfigLocation. The root context is then accessed by JSF (*.jsf) variable-resolver. It ...
10
votes
3answers
12k views

Howto get rid of <mvc:annotation-driven />?

Up to now, <mvc:annotation-driven /> has caused plenty of trouble for me, so I would like to get rid of it. Although the spring framework docs clearly say what it is supposed to be doing, a ...
11
votes
2answers
8k views

Spring 3 MVC: one-to-many within a dynamic form (add/remove on create/update)

I'm looking for a solution to manage a one-to-many relation within an HTML form using jQuery. I'm developing with Spring, Spring MVC and Hibernate. I found many tracks on the web, but not any working ...
19
votes
4answers
23k views

how to display custom error message in jsp for spring security auth exception

I want to display custom error message in jsp for spring security authentication exceptions. For wrong username or password, spring displays : Bad credentials what I need : Username/Password ...
42
votes
7answers
16k views

Spring MVC @PathVariable getting truncated

I have a controller that provides RESTful access to information: @RequestMapping(method = RequestMethod.GET, value = Routes.BLAH_GET + "/{blahName}") public ModelAndView getBlah(@PathVariable String ...
19
votes
3answers
19k views

Spring MVC : How to perform validation ?

I would like to know what is the cleanest and best way to perform form validation of user inputs. I have seen some developers implement org.springframework.validation.Validator. A question about that ...
35
votes
2answers
56k 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, ...
32
votes
7answers
37k views

How to unit test a Spring MVC controller using @PathVariable?

I have a simple annotated controller similar to this one: @Controller public class MyController { @RequestMapping("/{id}.html") public String doSomething(@PathVariable String id, Model model) { ...
50
votes
3answers
31k 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(){ ...

15 30 50 per page