0
字符串:爲什麼我不能在此JSP自定義標記中將scriptlet屬性傳遞給JSTL?
${prettyDate}
是輸出到頁面的這個自定義標籤,而不是美化日期字符串:被轉移
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ tag import="com.ocpsoft.pretty.time.PrettyTime, java.util.Date"%>
<%@ attribute name="dateParam" required="true" type="java.util.Date" %>
<%
PrettyTime p = new PrettyTime();
String prettyDate = p.format(dateParam);
jspContext.setAttribute("prettyDate", prettyDate);
%>
<c:out value="${prettyDate}"/>
我爲什麼這樣做,可以防止小腳本屬性(prettyDate
)到這個JSP自定義標籤中的JSTL?
就是這樣。謝謝。 – jts 2010-10-05 16:52:52