|
3 | 3 | import org.springframework.stereotype.Controller; |
4 | 4 | import org.springframework.ui.Model; |
5 | 5 | import org.springframework.web.bind.annotation.RequestMapping; |
6 | | -import org.springframework.web.bind.annotation.RequestParam; |
7 | | -import org.springframework.web.bind.annotation.ResponseBody; |
8 | | -import org.springframework.web.multipart.MultipartFile; |
9 | | - |
10 | | -import javax.servlet.http.HttpServletRequest; |
11 | 6 |
|
12 | 7 | @Controller |
13 | 8 | public class FreemarkController { |
14 | 9 |
|
15 | | - @RequestMapping("/") |
16 | | - public String index(Model model) { |
17 | | - return "index"; |
18 | | - } |
19 | | - |
20 | | - @RequestMapping("/toUpload") |
21 | | - public String toUpload(Model model) { |
22 | | - return "upload"; |
23 | | - } |
24 | | - |
25 | | - @RequestMapping("/toFormdata") |
26 | | - public String formdata(Model model) { |
27 | | - return "formdata"; |
28 | | - } |
29 | | - |
30 | | - @RequestMapping("/upload") |
31 | | - @ResponseBody |
32 | | - public String upload(@RequestParam("file") MultipartFile[] files, String name,HttpServletRequest request) { |
33 | | - if(files != null){ |
34 | | - for(MultipartFile file : files){ |
35 | | - System.out.println(file.getOriginalFilename()); |
36 | | - } |
37 | | - } |
38 | | - System.out.println(request.getParameter("name")); |
39 | | - return name; |
40 | | - } |
41 | | - |
42 | | - @RequestMapping("/formdata") |
43 | | - @ResponseBody |
44 | | - public String formdata(@RequestParam("file") MultipartFile[] files, String name,HttpServletRequest request) { |
45 | | - if(files != null){ |
46 | | - for(MultipartFile file : files){ |
47 | | - System.out.println(file.getOriginalFilename()); |
48 | | - } |
49 | | - } |
50 | | - System.out.println(request.getParameter("name")); |
51 | | - return name; |
52 | | - } |
| 10 | + @RequestMapping("/") |
| 11 | + public String index(Model model) { |
| 12 | + return "index"; |
| 13 | + } |
53 | 14 | } |
0 commit comments