Reputation: 174
in Spring MVC project, client send a request with an object serialize in it, client itself is an applet, so it doesn't expect to receive as a response a web page, but instead response with string object in it that will tell him if it was a success or fail. So what is the solution, i was thinking to use in a @Controller a method that returns void, or method that return non existent page? (in both case I also was wondering if there even be response back to client )
Upvotes: 2
Views: 1671
Reputation: 85266
In Spring 4:
@RestController
public class MyController {
@RequestMapping("/myurl")
public String myMethod() {
return "myResponse";
}
}
In Spring 3:
@Controller
public class MyController {
@RequestMapping("/myurl")
@ResponseBody
public String myMethod() {
return "myResponse";
}
}
Upvotes: 1