JSF转换标题属性的日期 [英] JSF Convert dates for title attribute
本文介绍了JSF转换标题属性的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将一个日期放在图像的title属性中,以便用户将鼠标放在何时显示。问题是我想更改日期格式。
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.
任何想法?
<ice:graphicImage value="bean.image" title="#{bean.date}"/>
推荐答案
直接在getter方法中执行
Either do it directly in a getter method
public String getDate() {
return new SimpleDateFormat("yyyy-MM-dd").format(this.date);
}
或抓住JSTL的 < fmt:formatDate>
。
or grab JSTL's <fmt:formatDate>
.
<fmt:formatDate value="#{bean.date}" pattern="yyyy-MM-dd" var="date" />
<ice:graphicImage value="bean.image" title="#{date}"/>
(在 UIData
)
这篇关于JSF转换标题属性的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文