First of all, I am new to java.time package.
I am writing a webapp that should work with certain times of the day and with multiple duration events.
So, I wrote my code using the LocalTime and Duration classes of the LocalTime package.
When I need to display their value in JSP, it is very simple for the LocalTime object (because .toString() returns a human readable scale), so I can just write ${startTime} and everything goes correctly (for example, it displays as 9:00 ). The same approach does not work for Duration, since its representation is something like PT20M (in this case, for 20 minutes).
Is there an elegant way to perform conversion to JSP directly using EL?
Yes, I know that I can convert an object to a string in my classes (before JSP), but I'm looking for a suggested approach (which I cannot find) ... another point is that I do not see the official method "convert () "(or any other) in the Duration object ... so I think I'm using the wrong object to display the length of time (to add or subtract LocalTime s).
Thanks.
source share