Forms 如何在playframework中使用多维数组提交表单,并将变量传递给控制器';s动作
我想提交这样的表格:Forms 如何在playframework中使用多维数组提交表单,并将变量传递给控制器';s动作,forms,variables,playframework,playframework-1.x,Forms,Variables,Playframework,Playframework 1.x,我想提交这样的表格: <input type="text" name="features[txt][1]" value="aaa"> <input type="text" name="features[txt][2]" value="bbb"> <input type="text" name="features[num][5]" value="124"> 要接收保存操作中的值,请执行以下操作: public static void save(Long i
<input type="text" name="features[txt][1]" value="aaa">
<input type="text" name="features[txt][2]" value="bbb">
<input type="text" name="features[num][5]" value="124">
要接收保存操作中的值,请执行以下操作:
public static void save(Long id, (??) Map<String, String> features) {
Logger.info("%s", features);
}
publicstaticvoidsave(长id,(??)映射功能){
Logger.info(“%s”,功能);
}
地图要素
-是获取要素
变量最成功的尝试。记录器说它等于{num=null,txt=null}。无论如何,地图功能
是错误的。我曾多次尝试获取功能
,但我刚刚收到null不确定这是否可行,但大致如下:
public static void save(Long id, @As("ids[][]:") Map<String, String> features) {
Logger.info("%s", features);
}
publicstaticvoidsave(长id,@As(“ids[][]:”)映射功能){
Logger.info(“%s”,功能);
}
这里也有类似的问题:不确定这是否有效,但大致如下:
public static void save(Long id, @As("ids[][]:") Map<String, String> features) {
Logger.info("%s", features);
}
publicstaticvoidsave(长id,@As(“ids[][]:”)映射功能){
Logger.info(“%s”,功能);
}
这里也提出了类似的问题:谢谢,但是没有。我尝试用许多不同的方式绑定
功能。它不起作用:(谢谢,但不行。我试图用许多不同的方式绑定功能。它不起作用:(