26
votes
5answers
51k 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}"}, ...
36
votes
13answers
48k 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 ...
48
votes
2answers
52k views

What is @ModelAttribute in Spring MVC? [closed]

Please elaborate on the purpose and usage of @ModelAttribute in Spring MVC.
22
votes
4answers
11k 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 ...
98
votes
4answers
47k 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 ...
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 ...
19
votes
4answers
22k 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 ...
10
votes
2answers
7k 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 ...
40
votes
2answers
31k 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 ...
35
votes
2answers
55k 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, ...
31
votes
7answers
36k 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) { ...
47
votes
3answers
29k 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(){ ...
20
votes
8answers
45k views

Spring 3.0 making JSON response using jackson message converter

i configure my messageconverter as Jackson's then class Foo{int x; int y} and in controller @ResponseBody public Foo method(){ return new Foo(3,4) } from that i m expecting to return a JSON ...
9
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 ...
37
votes
7answers
14k 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 ...

15 30 50 per page