0
使用播放框架,你可以做这样的事情:将参数绑定到模型而不指示模型名称?
public static void mymethod() {
// do stuff here
MyModel mymodel = new MyModel();
Binder.bindBean(params.getRootParamNode(), "mymodel", mymodel);
// equivalent to specifying this in the method params :
// mymethod (@Valid MyModel mymodel)
}
但这需要您发送您的PARAMS为“mymodel.name”,“mymodel.title”等(名称中带有&冠军模型)。
我想要做的就是摆脱“mymodel”。在参数中,只需发送“名称”,“标题”,并将它们直接绑定到我的模型。
我知道我不能做到这一点与@Valid
(当然,据我所知),但我想这样的事情,并没有奏效:
Binder.bindBean(params.getRootParamNode(), "", mymodel); // Nothing between quotes
我知道这是可能的,我以前找到它,但现在不能把它放在手上,你能帮我吗?