或者,声明Calculate#getAmount()作为EL函数。首先创建一个/WEB-INF/functions.tld档案:<?xml version="1.0" encoding="UTF-8" ?>
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
version="2.1">
Custom Functions
1.0
http://example.com/functions
calculateAmount
com.example.Calculate
double getAmount(double)
并以下列方式使用:
...
Amount: ${f:calculateAmount(row.balance)}">