• Post Reply Bookmark Topic Watch Topic
  • New Topic

date format within conditional test

 
Dave Brown
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, wondering if anyone can help me with this..

I'm outputting a date currently using..

${empty order.expiryDate ? "Non expiring" : order.expiryDate}

I want to also use fmt:formatDate.. Not sure how to use both the conditional test as well as fmt: tag..

Any suggestions..
[ September 06, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65531
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two ways spring to mind:

Since you cannot embed an action such as <fmt:formatDate> in an EL expression, switch to using <c:if> rather than the terniary operator.

or

Set the formatted date as a scoped variable prior to the terniary operator expresions, which uses one of the fixed string or stored date.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65531
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, never mind that last one... I see that you're testing for null.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!