首页 > 解决方案 > 添加删除选项后,我开始收到错误 500

问题描述

添加删除选项后,我在添加新对象后立即开始收到错误 500,不知道为什么。

我检查了所有标签是否都已关闭,它们是。eclipse没有指出错误。

HTML:

<div class="container">
    <div th:each="lembrete : ${lembretes}">
        <form method="post">
            <div class="postIt">
                <input type="text" class="titu" name="nome" th:value="${lembrete.nome}">
                <a class="btn" th:href="${(#mvc.url('EC#deletarLembrete').arg(0, lembrete.id)).build()}">x</a>
                <textarea class="txta" cols="30" name="descr" th:text="${lembrete.descr}"></textarea>
                <button class="btn2" type="submit">salvar</button>
            </div>
        </form>
    </div>
</div>

爪哇:

@Controller
public class LembreteController {    

@Autowired
private LembreteRepository lr;

@RequestMapping("/deletarLembrete")
public String deletarLembrete(long id) {
    Lembrete lembrete = lr.findById(id);
    lr.delete(lembrete);

    return "redirect:/eventos";
}
}

错误(我认为重要的部分):

org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/index.html]")

Caused by: org.attoparser.ParseException: Exception evaluating SpringEL expression: "(#mvc.url('EC#deletarLembrete').arg(0, lembrete.id)).build()" (template: "index" - line 27, col 21)

Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "(#mvc.url('EC#deletarLembrete').arg(0, lembrete.id)).build()" (template: "index" - line 27, col 21)

Caused by: java.lang.IllegalArgumentException: Mapping not found: EC#deletarLembrete

There was an unexpected error (type=Internal Server Error, status=500).
An error happened during template parsing (template: "class path resource [templates/index.html]")

标签: javahtmlspringthymeleaf

解决方案


推荐阅读