| Author |
jstl reformat date exception
|
Shilpa Tendulkar
Ranch Hand
Joined: Jul 29, 2001
Posts: 75
|
|
Hi all, I am having bit trouble formating date using jstl. <fmt:formatDate value="${mydate}" type="DATE" pattern="dd/MM/yyyy"/> I am using JSTL1.1 standard.jar and JSTL1.1 jstl.jar and stack trace is
|
SCJP5
|
 |
Shilpa Tendulkar
Ranch Hand
Joined: Jul 29, 2001
Posts: 75
|
|
After some research I found the solution. Because my value is string I can not directly use <fmt:formatDate> so I have to parse the date and then format it. Following is the solution: Thanks.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
|
Exactly, in the same way you couldn't pass a string to a method expecting a java.util.Date.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
PetriJ Airio
Greenhorn
Joined: Dec 18, 2007
Posts: 2
|
|
I had the same problem and found this solution works. However, what I'm now trying to do is create Tag which takes date string as parameter and does the same conversion. For some reasen the two lines of code in tag don't work even they work in the jsp-page. Here is my TAG, displayDate.tag: And from the jsp-page I try to call it like this: when the web:displayDate tag is executed I got exception: What is causing that the code works on the jsp-page but not inside the tag ? Best Regards, PetriJ Airio
|
 |
 |
|
|
subject: jstl reformat date exception
|
|
|