How to display a formatted DateTime in Spring MVC 3.0?

后端 未结 2 639
我寻月下人不归
我寻月下人不归 2020-12-14 19:05

I have a Joda-DateTime field in my model and want to display it formatted in a JSP view. I have annotated it with the new @DateTimeFormat annotation:

public          


        
2条回答
  •  忘掉有多难
    2020-12-14 20:00

    Because its a joda datetime object, and not a Date object, you will have to write your own formatting function or a custom tag.

    If you can convert it to java.util.Date somehow, then you can use the built in jstl's fmt taglibrary.

    
    

    But the latest jsp quickly allows you to create custom tags.

提交回复
热议问题