teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

ソースコード変更

2020/05/10 04:11

投稿

cout
cout

スコア13

title CHANGED
File without changes
body CHANGED
@@ -4,6 +4,22 @@
4
4
  public class SearchForm {
5
5
  private Date datefrom;
6
6
  private Date dateto;
7
+
8
+  public Date getDatefrom() {
9
+ return datefrom;
10
+ }
11
+ public void setDatefrom(Date datefrom) {
12
+ this.datefrom = datefrom;
13
+ }
14
+ public Date getDateto() {
15
+ return dateto;
16
+ }
17
+ public void setDateto(Date dateto) {
18
+ this.dateto = dateto;
19
+ }
20
+ }
21
+
22
+
7
23
  ```
8
24
 
9
25
  ```HTML
@@ -25,6 +41,15 @@
25
41
  ```Controller
26
42
  @PostMapping("/searchresult")
27
43
  public ModelAndView searchresult(@ModelAttribute("searchForm") SearchForm form,BindingResult result,
28
- ModelAndView mav)
44
+ ModelAndView mav,Search entity){
45
+ if(result.hasErrors()) {
46
+ return mav;
47
+ }
48
+    mav.setViewName("searchresult");
49
+ mav.addObject("searchForm", new SearchForm());
50
+     Iterable<Kakeibo> list = service.searchAll(form);
51
+   mav.addObject("datalist", list);
52
+ return mav;
53
+ }
29
54
  ```
30
55
  ![イメージ説明](1edc7a23c4a544f699e9e635799180cc.jpeg)

1

画像の追加

2020/05/10 04:11

投稿

cout
cout

スコア13

title CHANGED
File without changes
body CHANGED
@@ -26,4 +26,5 @@
26
26
  @PostMapping("/searchresult")
27
27
  public ModelAndView searchresult(@ModelAttribute("searchForm") SearchForm form,BindingResult result,
28
28
  ModelAndView mav)
29
- ```
29
+ ```
30
+ ![イメージ説明](1edc7a23c4a544f699e9e635799180cc.jpeg)