Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Utility Function  RSS feed

 
Michael Bradshaw
Greenhorn
Posts: 5
Hibernate Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a simple question, but I'm somewhat new to JSP. Suppose I have a simple utility function that I want to display in a JSP page. In my case, I have a Java Bean called Bill that has a bunch of Charges in it. I am displaying a list of Bills in a table on a JSP page, and I want to display the total charge for each Bill in each of the rows. To do this, I must write a utility function that adds up all the charges. What is the best way to do this? I could write the function in the Java Bean, but I'm told they shouldn't have business logic. (By the way, I'm using Spring MVC and my pages must be well-formed, and thus I'd like to avoid having to write a scriptlet in the JSP page.)
 
Nam Ha
Ranch Hand
Posts: 50
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use JSTL tags in your JSP page?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adding up some numbers for display purposes doesn't constitute business logic in my books. Persisting that sum to the model? yeah, that's business logic.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!