質問編集履歴
1
FormEntityの内容(一部)を記載しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
<table>
|
18
18
|
<tr th:each="item : ${SelectList}">
|
19
19
|
<td>
|
20
|
-
<input type="checkbox" name="checkbox" th:id="${item.Id}" th:value="${item.Id}" th:field="*{
|
20
|
+
<input type="checkbox" name="checkbox" th:id="${item.Id}" th:value="${item.Id}" th:field="*{checks}" th:checked="${FormEntity.checks=='1'}" />
|
21
21
|
<label th:for="${item.Id}" class="checkbox"></label>
|
22
22
|
</td>
|
23
23
|
<td>
|
@@ -35,7 +35,7 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
```controller
|
38
|
-
@RequestMapping(value="/
|
38
|
+
@RequestMapping(value="/Test",params = "submit",method = RequestMethod.POST)
|
39
39
|
public ModelAndView Submit_Class(FormEntity FormEntity, Model model) throws ParseException {
|
40
40
|
//ここでどうにかしてチェックボックスにチェックを入れた値を取得したい。
|
41
41
|
}
|
@@ -44,19 +44,46 @@
|
|
44
44
|
|
45
45
|
ちなみにですが、実際に出力されているHTMLは以下の通りです。
|
46
46
|
```HTML
|
47
|
-
<input type="checkbox" name="
|
47
|
+
<input type="checkbox" name="checks" id="1" value="1">
|
48
|
-
<input type="hidden" name="
|
48
|
+
<input type="hidden" name="_checks" value="on">
|
49
49
|
<label for="1" class="checkbox"></label>
|
50
50
|
|
51
|
-
<input type="checkbox" name="
|
51
|
+
<input type="checkbox" name="checks" id="2" value="2">
|
52
|
-
<input type="hidden" name="
|
52
|
+
<input type="hidden" name="_checks" value="on">
|
53
53
|
<label for="2" class="checkbox"></label>
|
54
54
|
|
55
|
-
<input type="checkbox" name="
|
55
|
+
<input type="checkbox" name="checks" id="3" value="3">
|
56
|
-
<input type="hidden" name="
|
56
|
+
<input type="hidden" name="_checks" value="on">
|
57
57
|
<label for="3" class="checkbox"></label>
|
58
58
|
```
|
59
59
|
|
60
60
|
皆様のお力をお借りできれば幸いです。
|
61
61
|
|
62
|
-
よろしくお願いいたします。
|
62
|
+
よろしくお願いいたします。
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
追記:
|
68
|
+
FormEntityの値を追加しました。
|
69
|
+
checkboxの配列を入れる予定のFormはこちらになります。
|
70
|
+
|
71
|
+
|
72
|
+
```FormEntity
|
73
|
+
|
74
|
+
@Getter
|
75
|
+
@Setter
|
76
|
+
public class FormEntity {
|
77
|
+
|
78
|
+
private String[] checks;
|
79
|
+
|
80
|
+
public void setChecks(String[] checks) {
|
81
|
+
this.checks = Checks;
|
82
|
+
}
|
83
|
+
|
84
|
+
public String[] getChecks() {
|
85
|
+
return checks;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
```
|
89
|
+
よろしくお願いします。
|