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

質問編集履歴

2

pathの変更点について

2021/08/23 07:36

投稿

asahiko123
asahiko123

スコア43

title CHANGED
File without changes
body CHANGED
@@ -135,8 +135,18 @@
135
135
 
136
136
  ```
137
137
 
138
+ ・Pathがローカルを参照していたので、プロジェクトのルートディレクトリ以下に変更しましたが、変化ありませんでした
139
+ ```
140
+ Paths.get("C:\Users\hullh\git\DailyReport\src\main\resources\static\excel\template_dailyReport.xlsx");
141
+ →変更後
142
+ Paths.get("DailyReport\src\main\resources\static\excel\template_dailyReport.xlsx");
138
143
 
144
+ out = new FileOutputStream("C:\Users\Public\result.xlsx");
145
+ →変更後
146
+ out = new FileOutputStream("DailyReport\src\main\resources\static\excel\result.xlsx");
139
147
 
148
+ ```
149
+
140
150
  ### 補足情報(FW/ツールのバージョンなど)
141
151
 
142
152
  Springboot v2.5.0

1

試したこと追記

2021/08/23 07:36

投稿

asahiko123
asahiko123

スコア43

title CHANGED
File without changes
body CHANGED
@@ -118,7 +118,25 @@
118
118
 
119
119
  上記はエクセル出力を行うコントローラーですが、ローカルでは問題なく出力できました。
120
120
 
121
+ 他の質問ページ(https://teratail.com/questions/292561)で同じく500エラーの問題が扱われていましたが、
122
+ 自分の場合はスラッシュが入っていても以下のdeleteはエラーにならずheroku上で機能しています。
123
+ ```
124
+ @PostMapping("/report/delete")
125
+ public String delete(
126
+ Model model,
127
+ DailyReport dailyReport,
128
+ @RequestParam("dailyReportId")int id
129
+ ) {
130
+
131
+ dailyReportService.deleteById(id);
132
+ return"redirect:/main/report";
133
+
134
+ }
135
+
136
+ ```
121
137
 
138
+
139
+
122
140
  ### 補足情報(FW/ツールのバージョンなど)
123
141
 
124
142
  Springboot v2.5.0