This content has been marked as final.
Show 4 replies
-
1. Re: JBoss EL date formatting
damianharvey Nov 27, 2007 10:12 AM (in response to manuel.martin)There are a plethora of options open to you here.
1. If the messages.properties message is just 'My date is'. Then you just print out your date eg:#{messages['message']}<h:outputText value="#{myDate}"><s:convertDateTime dateStyle="yyyy-MM-dd"/></h:outputText>
2. If the messages.properties message is 'My Date is {0}' then you could create the message in your Bean using MessageFormat eg:@In Map<String, String> messages; .. public String getMyMessage() { return MessageFormat.format(messages.get("message"), new SimpleDateFormat("yyyy-MM-dd").format(this.myDate)); }
I'm sure that there are several other ways of doing it.
Cheers,
Damian. -
2. Re: JBoss EL date formatting
manuel.martin Nov 27, 2007 10:33 AM (in response to manuel.martin)Thank you Damian, I discard Option 1 because:
Maybe in other languages the phrase may be writen with another words order. EJ:#{myDate} is the date
But option 2 is useful for me:My date is {0,date,dd-MM-yyyy}
But, do you know if I can pass these parameters throug EL? Ej:#{messages['message'](myDate)}
or something like these?
Thanks! -
3. Re: JBoss EL date formatting
damianharvey Nov 27, 2007 11:00 AM (in response to manuel.martin)Don't think that you can. It's a Map so doesn't have that ability. It shouldn't be too difficult to write your own MessageFormat type component though.
Cheers,
Damian. -
4. Re: JBoss EL date formatting
mars1412 Dec 11, 2007 11:25 AM (in response to manuel.martin)maybe this will help u:
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4100761