views:

35

answers:

1
@RequestMapping(value = "/post/{postThreadId}", method = RequestMethod.GET)
@ResponseBody
public String paramTest(PostParams params) {
    return params.toString();
}

Spring MVC Path Variable ("postThreadID") can be mapped to Command object field?

PostParams have setPostThreadId(int ...) But, it looks not working.

+2  A: 

I don't think this is possible.

Set it manually:

public String paramTest(PostParams params, @PathVariable int postThreadId) {
    params.setPostThreadId(postThreadId);
    ....
}
Bozho
And it shouldn't be working at all, because controllers are singletons.
Philipp Jardas
Thank you for answer.
drypot