0

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}"/>
DD.
  • 21,498
  • 52
  • 157
  • 246

1 Answers1

2

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
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • 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. Mar 03 '10 at 17:10
  • Then it's either inside a repeating component, or the date value isn't available during restore view. – BalusC Mar 03 '10 at 17:48
  • 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. Mar 04 '10 at 08:56