如何将joda time DateTime与Thymeleaf一起使用

如何将joda time DateTime与Thymeleaf一起使用,datetime,converter,spring-boot,jodatime,thymeleaf,Datetime,Converter,Spring Boot,Jodatime,Thymeleaf,我有以下控制器: @RequestMapping(value="/usage", method=RequestMethod.GET) public String usage(Model model) { CallDataRecordLine calldatarecordline = new CallDataRecordLine(); model.addAttribute("calldatarecordline",calldatarecordline); return "u

我有以下控制器:

@RequestMapping(value="/usage", method=RequestMethod.GET)
public String usage(Model model) {
    CallDataRecordLine calldatarecordline = new CallDataRecordLine();
    model.addAttribute("calldatarecordline",calldatarecordline);
    return "usage";
}
@RequestMapping(value="/usage", method=RequestMethod.POST)
public String greetingSubmit(@ModelAttribute CallDataRecordLine calldatarecordline, Model model) {
    model.addAttribute("calldatarecordline",calldatarecordline);
    return "result";
}
实体描述如下

public class CallDataRecordLine {

    int chargedQuantity;
    String fromNumber;
    String toNumber;
    DateTime dt;
    String usage;
    String chargeableQuantity;
    //getters/setters
}
以及链接到控制器的视图

<form id="calldatarecordForm" class="form-horizontal" role="form"
    action="#" th:action="@{/usage}" th:object="${calldatarecordline}"
    method="post">

    <input type="text" th:field="*{fromNumber}" class="form-control" /> <input
        type="text" th:field="*{toNumber}" class="form-control" /> <input
        type="datetime" th:field="*{dt}" class="form-control" /> <input
        type="text" th:field="*{chargedQuantity}" class="form-control" /> <input
        type="text" th:field="*{usage}" class="form-control" /> <input
        type="text" th:field="*{chargeableQuantity}" class="form-control" />


    <button type="submit">Test</button>
</form>

试验
显然,th:field无法转换jodaTime-DateTime(我已尝试删除dt属性,并且正确创建了CallDataRecordLine)。我知道可以使用converter/formatter,但我使用的是SpringBoot,我真的不知道怎么做,因为所有配置都是自动加载的。我尝试了两种输入类型=“text”/“datetime”,但都不起作用
非常感谢您的帮助。

请看一下jodatime方言


另外,根据W3Type,我会保留type=“text”,因为任何浏览器都不支持datetime

谢谢,我已经用以下内容打印了现有的JodaTime日期:
th:text=“${joda.mediumDate(Date)}”
。但我找不到如何以一种有任何想法的形式进行分配?在商业项目中使用jodatime thymeleaf方言时要小心,许可证是GPL