0
Good afternoon, you guys, I am with a difficulty, I am developing a simple system, it reads a csv file and imports to a database, I risked using Thymeleaf, I found some tutorials but I could not understand very well, if someone knows how to do, please give me a light kkk I was trying to do so at the front:
    <form th:action="@{/upload}" enctype="application/x-www-form-urlencoded">
    <input type="file" name="file" id="file"/></br>
    <input type="submit" name="submit" value="Importar">
</form>
and in the backend:
@GetMapping("/upload")
public void importar(MultipartFile mf) {
    try {
        importService.montaAbastecimento(mf);
    } catch (Exception e) {
        System.out.println("Erro ao importar: " + e.getMessage());
    }
}
this is just the method I want to call, the class is annotated with @Controller
And what’s the problem?
– nullptr
I don’t know much about Thymeleaf, but if backend you expect an object
MultipartFile, you shouldn’t send a Multipart also?– Woss
@nullptr the problem is this Thymeleaf template Might not exist or Might not be accessible by any of the configured Template Resolvers
– Ricardo Campos
add the stacktrace to the question
– nullptr
@Andersoncarloswoss then Anderson I also do not know much, I saw some examples like this, but I do not know exactly with q type the Thymeleaf sends these files, at first tried with Java File but also did not roll
– Ricardo Campos
@nullptr I followed the tip of the friend down there Tiago, he changed the stack, I’ll go back as was and post for you to see
– Ricardo Campos