membersound membersound - 12 days ago 4x
reST (reStructuredText) Question

How to map @RequestParam to object?

@RequestMapping(method = RequestMethod.GET)
public String content(
@RequestParam int a,
@RequestParam String b,
@RequestParam String n;
) {


Can I somehow directly map all the
s into a java object, like?

public class RestDTO {
private int a;
private String b;
private String n;


In my opinon you have anything to do. The content method will be something like that :

public String content(@RequestParam RestDTO restDTO){...}

restDTO should have the correct setters. What happened when you do this ?