접근 방식은 JTSL에 대한 사용자 정의 함수를 만드는 것입니다 :
이/아래 .TLD 파일 만들기 WEB을-INF
<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.1" 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">
<tlib-version>1.0</tlib-version>
<short-name>tlds</short-name>
<uri>http://www.sometld.com/tlds</uri>
<function>
<name>someMethod</name>
<function-class>org.domain.Functions</function-class>
<function-signature>double someMethod(double)</function-signature>
</function>
</taglib>
정적 메서드
package org.domain;
public class Functions
{
public static double someMethod(double value)
{
...
return someValue;
}
}
그리고있는 클래스를 만듭니다 그것을 사용하십시오
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://www.sometld.com/tlds" prefix="mfn" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
${mfn:someMethod(123.999)}
</body>
</html>
출처
2014-12-04 00:50:07
Sal
'value = "$ {Method (t_variable)}"'시도해 보시겠습니까? – developerwjk