JSF Convert dates for title attribute

后端 未结 1 1816
我寻月下人不归
我寻月下人不归 2021-01-27 12:31

I need to put a date into the title attribute of an image so that it displays when the user puts the mouse over. Problem is I would like to change the date format.

Any i

相关标签:
1条回答
  • 2021-01-27 12:59

    Either do it directly in a getter method

    public String getDate() {
        return new SimpleDateFormat("yyyy-MM-dd").format(this.date); 
    }
    

    or grab JSTL's <fmt:formatDate>.

    <fmt:formatDate value="#{bean.date}" pattern="yyyy-MM-dd" var="date" />
    <ice:graphicImage value="bean.image" title="#{date}"/>
    

    (which would not work inside repeating components like UIData)

    0 讨论(0)
提交回复
热议问题