How to get static method value in jsp without crea

2019-07-30 03:52发布

Below code for bytes to kb conversion code its for Static return type.So how can i get a value in many jsp without creation bean.

public static double bytesToKB(int bytes){
  return (double)bytes/1024;
}

1条回答
萌系小妹纸
2楼-- · 2019-07-30 04:05

how about this?

<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>

<spring:eval expression="T(com.abc.xyz.YourClassName).bytesToKB(2560)" var="result"></spring:eval>
Spring Eval result: <c:out value="${result }"/>
查看更多
登录 后发表回答