membersound membersound - 1 year ago 161
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;

Answer Source

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 ?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download