• Post Reply Bookmark Topic Watch Topic
  • New Topic

jstl miliseconds to Date  RSS feed

 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to convert milliseconds to Date in Jstl?
Thank you!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If milliseconds isn't what you need on the JSP, how did it get there in the first place?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My point begin, of course, that such conversions should happen before getting to the JSP. The page controller should do all the work of preparing data for the display on the JSP, making the job of the JSP as easy as possible. Strive for smart controllers and dumb JSPs.

That said, you can use the bean variant of <c:set> to set the time property of a Date instance.
 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After struggling with Jstl for a while I made changes to the model to contain Date instead of milis....
Just out of curiosity I didn’t get your solution...
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your solution is one of the correct ones. Do the work before you get to the JSP so that the JSP remains as simple as possible.

But with regards to my solution, consider:

 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed now the Jsp is simple..

Thank you for the informative post!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!