Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <table>
- <tr><th>File Name</th>
- </tr>
- <tr th:each="file : ${filedata}">
- <td>
- <form action="#" th:action="@{~/home/ebay/getfile}" method="post" th:object="${filetobind}">
- <!-- th:field maps to object -->
- <input type="text" th:field="*{fileName}" th:value="#{file.fileName}" th:text="${file.fileName}"/>
- <input type="submit" value="Get" />
- </form>
- </td>
- </tr>
- </table>
- @GetMapping(Mappings.FILES)
- public String getDirectory(Model model){
- model.addAttribute(AttributeNames.FILE_DATA, fileService.getDirectory());
- model.addAttribute(AttributeNames.FILE, new DirectoryFile());
- // debug
- System.out.println("#############################################################");
- for(DirectoryFile file : fileService.getDirectory()){
- System.out.println(file.getFilePath());
- }
- System.out.println("#############################################################");
- return ViewNames.DIRECTORY;
- }
- @PostMapping("getfile")
- public String getFile(Model model, @ModelAttribute(AttributeNames.FILE) DirectoryFile file ){
- System.out.println("Filepath:" + file.getFileName());
- //model.addAttribute(AttributeNames.FILE, file.getFileName().trim());
- return "data/" + file.getFileName();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement