• Post Reply Bookmark Topic Watch Topic
  • New Topic

Convert minutes to hours and minutes using JSTL and Java  RSS feed

 
Brinsley Dcunha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi there, I'm fairly new to JSTL. Can I convert the minutes JSTL expression into hours and minutes using a java method. I'm not sure how to go about.

<% CalendarUtilities.getHoursAndMinutes(%> ${minutes} <% ) %>

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
The first thing that you don't want to do is to combine obsolete and discredited Java scriptlet code with JSTL code. If you are going to use scriptlets (bad idea -- they've been obsolete for over 12 years), then just use scriptlets. If you are going to use JSTL and EL, then just use just the JSTL and EL. Scriptlets and JSTL are not meant to interact, and trying to make them do so would create a huge old mess.

The best way to approach your original question is to either:
  • perform the calculation in the controller so that the JSP doesn't have to do the work
  • map your Java function as an EL function (if it's static)
  • Call the member method via the EL (if using the latest version of JSP and the method is on a bean)
  • Create a custom tag if this is something you will do often
  •  
    Don't get me started about those stupid light bulbs.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!