BaumTom
Jan 25th, 2012, 02:29 AM
Hello,
I use a controller class that has a method with a @ModelAttribute parameter:
@Controller()
public class SomeController {
@RequestMapping({ "/show" })
public ModelAndView show(@ModelAttribute("entry") SomeEntry entry) {
return new ModelAndView("show");
}
}
public class SomeEntry {
private String a;
private String b;
private String c;
public String getA() {
return a;
}
public void setA(String a) {
this.a = a;
}
public String getB() {
return b;
}
public void setB(String b) {
this.b = b;
}
public String getC() {
return c;
}
public void setC(String c) {
this.c = c;
}
}
When the @ModelAttribute "entry" is filled in a POST request, the setters of "entry" are called in the following order:
1. setA
2. setB
3. setC
Can I specify in which order the setters are called? For example:
1. setC
2. setA
3. setB
Regards
Thomas
I use a controller class that has a method with a @ModelAttribute parameter:
@Controller()
public class SomeController {
@RequestMapping({ "/show" })
public ModelAndView show(@ModelAttribute("entry") SomeEntry entry) {
return new ModelAndView("show");
}
}
public class SomeEntry {
private String a;
private String b;
private String c;
public String getA() {
return a;
}
public void setA(String a) {
this.a = a;
}
public String getB() {
return b;
}
public void setB(String b) {
this.b = b;
}
public String getC() {
return c;
}
public void setC(String c) {
this.c = c;
}
}
When the @ModelAttribute "entry" is filled in a POST request, the setters of "entry" are called in the following order:
1. setA
2. setB
3. setC
Can I specify in which order the setters are called? For example:
1. setC
2. setA
3. setB
Regards
Thomas