views:

43

answers:

1

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 ideas?

<ice:graphicImage value="bean.image" title="#{bean.date}"/>
A: 

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)

BalusC
Hi Balus...really quick question. I add JSTL to the pom and the following to the header: xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" I cant get it to work...any ideas what is going wrong? It just doesnt display anything on the title.
DD
Then it's either inside a repeating component, or the date value isn't available during restore view.
BalusC
I cant even get a simple hello world to work http://stackoverflow.com/questions/2373592/how-do-you-use-jstl .Not sure if there something else I have to do to enable the tag library.
DD