質問編集履歴
3
不要部分の削除
test
CHANGED
File without changes
|
test
CHANGED
@@ -81,10 +81,6 @@
|
|
81
81
|
|
82
82
|
}
|
83
83
|
|
84
|
-
```
|
85
|
-
|
86
|
-
```HTML
|
87
|
-
以下に修正
|
88
84
|
```
|
89
85
|
|
90
86
|
どこかおかしい部分はあるでしょうか?
|
2
HTMLの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -155,23 +155,23 @@
|
|
155
155
|
<col style="width:200px"/>
|
156
156
|
<tr th:each="tableColumn, st : *{tableColumnList}">
|
157
157
|
<td class="left"><span th:text="${tableColumn.no}"></span>
|
158
|
-
<input type="hidden" th:field="*{tableColumnList[__${st.index}__].no}" name="n
|
158
|
+
<input type="hidden" th:field="*{tableColumnList[__${st.index}__].no}" th:name="${st.count}"></td>
|
159
159
|
<td class="left"><span th:text="${tableColumn.komoku_name}"></span>
|
160
|
-
<input type="hidden" th:field="*{tableColumnList[__${st.index}__].komoku_name}" name="
|
160
|
+
<input type="hidden" th:field="*{tableColumnList[__${st.index}__].komoku_name}" th:name="${st.count}"></td>
|
161
161
|
<td class="left"><span th:text="${tableColumn.type}"></span>
|
162
|
-
<input type="hidden" th:field="*{tableColumnList[__${st.index}__].type}" name="t
|
162
|
+
<input type="hidden" th:field="*{tableColumnList[__${st.index}__].type}" th:name="${st.count}"></td>
|
163
163
|
<td class="left"><span th:text="${tableColumn.length}"></span>
|
164
|
-
<input type="hidden" th:field="*{tableColumnList[__${st.index}__].length}" name="
|
164
|
+
<input type="hidden" th:field="*{tableColumnList[__${st.index}__].length}" th:name="${st.count}"></td>
|
165
165
|
<td class="left"><input type="checkbox" name="checkbox" th:value="*{tableColumnList[__${st.index}__].checkbox}" th:checked="*{tableColumnList[__${st.index}__].checkbox}"></input></td>
|
166
166
|
<td class="left">
|
167
|
-
<select th:value="*{tableColumnList[__${st.index}__].jyoken}" name="
|
167
|
+
<select th:value="*{tableColumnList[__${st.index}__].jyoken}" th:name="${st.count}">
|
168
168
|
<option value="0"></option>
|
169
169
|
<option value="1"> = </option>
|
170
170
|
<option value="2"> >= </option>
|
171
171
|
<option value="3"> <= </option>
|
172
172
|
</select>
|
173
173
|
</td>
|
174
|
-
<td class="left"><input type="text" name="
|
174
|
+
<td class="left"><input type="text" th:name="${st.count}" size="20" th:field="*{tableColumnList[__${st.index}__].atai}" class="inputn"></input></td>
|
175
175
|
</tr>
|
176
176
|
</table>
|
177
177
|
</div>
|
1
HTMLの修正、エラーログの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -9,164 +9,61 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
```Java
|
12
|
-
package com.builders.euctools.entity;
|
13
|
-
|
14
|
-
import javax.persistence.Entity;
|
15
|
-
import javax.persistence.Id;
|
16
|
-
|
17
|
-
import lombok.Data;
|
18
|
-
|
19
|
-
//テーブルカラムEntity
|
20
12
|
@Entity
|
21
13
|
@Data
|
22
14
|
public class TableColumn {
|
23
|
-
|
24
|
-
/**
|
25
|
-
* 項目No
|
26
|
-
*/
|
27
15
|
@Id
|
28
16
|
public String no;
|
29
|
-
|
30
|
-
|
17
|
+
|
31
|
-
* テーブル名
|
32
|
-
*/
|
33
18
|
public String table_name;
|
34
|
-
|
35
|
-
|
19
|
+
|
36
|
-
* 項目名
|
37
|
-
*/
|
38
20
|
public String komoku_name;
|
39
21
|
|
40
|
-
/**
|
41
|
-
* データ型
|
42
|
-
*/
|
43
22
|
public String type;
|
44
|
-
|
45
|
-
|
23
|
+
|
46
|
-
* 長さ
|
47
|
-
*/
|
48
24
|
public String length;
|
49
|
-
|
50
|
-
|
25
|
+
|
51
|
-
* チェックボックス
|
52
|
-
*/
|
53
|
-
public String checkbox
|
26
|
+
public String checkbox
|
54
|
-
|
55
|
-
|
56
|
-
|
27
|
+
|
57
|
-
* 条件
|
58
|
-
*/
|
59
28
|
public String jyoken;
|
60
|
-
|
61
|
-
|
29
|
+
|
62
|
-
* 値
|
63
|
-
*/
|
64
30
|
public String atai;
|
65
31
|
}
|
66
32
|
```
|
67
33
|
|
68
34
|
```Java
|
69
|
-
package com.builders.euctools.dto;
|
70
|
-
|
71
|
-
imp
|
35
|
+
public class TableColumnDto implements Serializable{
|
72
|
-
|
73
|
-
import javax.persistence.Id;
|
74
|
-
|
75
|
-
import lombok.Data;
|
76
|
-
|
77
|
-
//テーブルカラムDto
|
78
36
|
@Data
|
79
|
-
public class TableColumnDto implements Serializable{
|
80
|
-
|
81
|
-
/**
|
82
|
-
* 項目No
|
83
|
-
*/
|
84
37
|
@Id
|
85
38
|
public String no;
|
86
|
-
|
87
|
-
|
39
|
+
|
88
|
-
* テーブル名
|
89
|
-
*/
|
90
40
|
public String table_name;
|
91
|
-
|
92
|
-
|
41
|
+
|
93
|
-
* 項目名
|
94
|
-
*/
|
95
42
|
public String komoku_name;
|
96
43
|
|
97
|
-
/**
|
98
|
-
* データ型
|
99
|
-
*/
|
100
44
|
public String type;
|
101
|
-
|
102
|
-
|
45
|
+
|
103
|
-
* 長さ
|
104
|
-
*/
|
105
46
|
public String length;
|
106
|
-
|
107
|
-
|
47
|
+
|
108
|
-
* チェックボックス
|
109
|
-
*/
|
110
48
|
public String checkbox;
|
111
|
-
|
112
|
-
|
113
|
-
|
49
|
+
|
114
|
-
* 条件
|
115
|
-
*/
|
116
50
|
public String jyoken;
|
117
|
-
|
118
|
-
|
51
|
+
|
119
|
-
* 値
|
120
|
-
*/
|
121
52
|
public String atai;
|
122
53
|
}
|
123
54
|
```
|
124
55
|
|
125
56
|
```Java
|
126
|
-
package com.builders.euctools.dto;
|
127
|
-
|
128
|
-
import java.io.Serializable;
|
129
|
-
import java.util.List;
|
130
|
-
|
131
|
-
import javax.validation.Valid;
|
132
|
-
|
133
|
-
import lombok.Data;
|
134
|
-
|
135
|
-
/**
|
136
|
-
* テーブルダウンロード一覧画面
|
137
|
-
*/
|
138
57
|
@Data
|
139
58
|
public class ColumnListParam implements Serializable {
|
140
|
-
|
141
|
-
/**
|
142
|
-
* ダウンロード情報リスト
|
143
|
-
*/
|
144
59
|
@Valid
|
145
60
|
public List<TableColumnDto> tableColumnList;
|
146
|
-
|
147
|
-
}
|
61
|
+
}
|
148
|
-
|
62
|
+
|
149
|
-
```
|
63
|
+
```
|
150
|
-
|
64
|
+
|
151
|
-
```Java
|
65
|
+
```Java
|
152
|
-
package com.builders.euctools.controller;
|
153
|
-
|
154
|
-
import java.util.List;
|
155
|
-
|
156
|
-
import org.springframework.beans.factory.annotation.Autowired;
|
157
|
-
import org.springframework.stereotype.Controller;
|
158
|
-
import org.springframework.web.bind.annotation.ModelAttribute;
|
159
|
-
import org.springframework.web.bind.annotation.RequestMapping;
|
160
|
-
import org.springframework.web.bind.annotation.RequestMethod;
|
161
|
-
import org.springframework.web.servlet.ModelAndView;
|
162
|
-
|
163
|
-
import com.builders.euctools.dto.ColumnListParam;
|
164
|
-
import com.builders.euctools.entity.Syain;
|
165
|
-
import com.builders.euctools.service.TableService;
|
166
|
-
import com.builders.euctools.view.DownloadXlsxView;
|
167
|
-
|
168
66
|
@Controller
|
169
|
-
|
170
67
|
public class TableColumnController {
|
171
68
|
@Autowired
|
172
69
|
TableService tableService;
|
@@ -185,6 +82,18 @@
|
|
185
82
|
}
|
186
83
|
|
187
84
|
```
|
85
|
+
|
86
|
+
```HTML
|
87
|
+
以下に修正
|
88
|
+
```
|
89
|
+
|
90
|
+
どこかおかしい部分はあるでしょうか?
|
91
|
+
ご教授よろしくお願いします。
|
92
|
+
> 引用テキスト
|
93
|
+
回答ありがとうございました。
|
94
|
+
ご指摘頂いた通り、name属性を追記して以下のようなHTMLに修正しましたが、
|
95
|
+
エラーは変わりませんでした。
|
96
|
+
詳細なエラーも追記します。
|
188
97
|
|
189
98
|
```HTML
|
190
99
|
<!DOCTYPE html>
|
@@ -245,20 +154,24 @@
|
|
245
154
|
<col style="width:100px"/>
|
246
155
|
<col style="width:200px"/>
|
247
156
|
<tr th:each="tableColumn, st : *{tableColumnList}">
|
248
|
-
<td class="left"><span th:text="
|
157
|
+
<td class="left"><span th:text="${tableColumn.no}"></span>
|
158
|
+
<input type="hidden" th:field="*{tableColumnList[__${st.index}__].no}" name="no"></td>
|
249
|
-
<td class="left"><span th:text="
|
159
|
+
<td class="left"><span th:text="${tableColumn.komoku_name}"></span>
|
160
|
+
<input type="hidden" th:field="*{tableColumnList[__${st.index}__].komoku_name}" name="komoku_name"></td>
|
250
|
-
<td class="left"><span th:text="
|
161
|
+
<td class="left"><span th:text="${tableColumn.type}"></span>
|
162
|
+
<input type="hidden" th:field="*{tableColumnList[__${st.index}__].type}" name="type"></td>
|
251
|
-
<td class="left"><span th:text="
|
163
|
+
<td class="left"><span th:text="${tableColumn.length}"></span>
|
164
|
+
<input type="hidden" th:field="*{tableColumnList[__${st.index}__].length}" name="length"></td>
|
252
|
-
<td class="left"><input type="checkbox" name="check" th:value="*{tableColumnList[__${st.index}__].checkbox}" th:checked="*{tableColumnList[__${st.index}__].checkbox}"></input></td>
|
165
|
+
<td class="left"><input type="checkbox" name="checkbox" th:value="*{tableColumnList[__${st.index}__].checkbox}" th:checked="*{tableColumnList[__${st.index}__].checkbox}"></input></td>
|
253
166
|
<td class="left">
|
254
|
-
<select th:value="*{tableColumnList[__${st.index}__].jyoken}">
|
167
|
+
<select th:value="*{tableColumnList[__${st.index}__].jyoken}" name="jyoken">
|
255
168
|
<option value="0"></option>
|
256
169
|
<option value="1"> = </option>
|
257
170
|
<option value="2"> >= </option>
|
258
171
|
<option value="3"> <= </option>
|
259
172
|
</select>
|
260
173
|
</td>
|
261
|
-
<td class="left"><input type="text" size="20" th:field="*{tableColumnList[__${st.index}__].atai}" class="inputn"></input></td>
|
174
|
+
<td class="left"><input type="text" name="atai" size="20" th:field="*{tableColumnList[__${st.index}__].atai}" class="inputn"></input></td>
|
262
175
|
</tr>
|
263
176
|
</table>
|
264
177
|
</div>
|
@@ -287,52 +200,15 @@
|
|
287
200
|
</body>
|
288
201
|
</html>
|
289
202
|
```
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
import org.springframework.web.servlet.view.document.AbstractXlsxView;
|
303
|
-
|
304
|
-
import com.builders.euctools.entity.Syain;
|
305
|
-
|
306
|
-
public class DownloadXlsxView extends AbstractXlsxView {
|
307
|
-
protected void buildExcelDocument(Map<String, Object> model, Workbook workbook, HttpServletRequest request,
|
308
|
-
HttpServletResponse response) throws Exception {
|
309
|
-
@SuppressWarnings("unchecked")
|
310
|
-
List<Syain> syain = (List<Syain>) model.get("syain");
|
311
|
-
|
312
|
-
Sheet sheet = workbook.createSheet("Recent messages");
|
313
|
-
|
314
|
-
// create header
|
315
|
-
Row row = sheet.createRow(0);
|
316
|
-
row.createCell(0).setCellValue("syain_no");
|
317
|
-
row.createCell(1).setCellValue("syain_name");
|
318
|
-
row.createCell(2).setCellValue("shiten_id");
|
319
|
-
|
320
|
-
for (int i=0; i<syain.size(); i++) {
|
321
|
-
Syain syainList = syain.get(i);
|
322
|
-
row = sheet.createRow(i+1);
|
323
|
-
row.createCell(0).setCellValue(syainList.getSyain_no());
|
324
|
-
row.createCell(1).setCellValue(syainList.getSyain_name());
|
325
|
-
row.createCell(2).setCellValue(syainList.getShiten_id());
|
326
|
-
}
|
327
|
-
// adjust column width
|
328
|
-
for (int i=0; i<5; i++) {
|
329
|
-
sheet.autoSizeColumn(i);
|
330
|
-
}
|
331
|
-
}
|
332
|
-
|
333
|
-
}
|
334
|
-
```
|
335
|
-
|
336
|
-
どこかおかしい部分はあるでしょうか?
|
337
|
-
ご教授よろしくお願いします。
|
338
|
-
> 引用テキスト
|
203
|
+
### 発生している問題・エラーメッセージ
|
204
|
+
```エラーログ
|
205
|
+
[dispatcherServlet] [0;39m [2m:[0;39m Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
|
206
|
+
|
207
|
+
java.lang.NullPointerException: null
|
208
|
+
at com.builders.euctools.controller.TableColumnController.downloadXlsx(TableColumnController.java:36) ~[classes/:na]
|
209
|
+
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
|
210
|
+
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
|
211
|
+
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
|
212
|
+
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
|
213
|
+
```
|
214
|
+
|