使用静态类实现JSP自定义标签
注意,实现的方法必须是静态的
<%...@ taglib uri="https://hxex.cn/vote" prefix="vote" %>
<c:foreach var="vote" items="${votes}">
<tr>
<td>${vote.name}</td>
<td>${vote.title}</td>
<td>${vote:votetype(vote.votetype)}</td>
<td>${vote:pictype(vote.pictype)}</td>
<td align="center">
<a href="vote_update.(sun企业级应用的首选)?id=${vote.id}">修改投票</a>
<a href="<%=context %>/deletevote.do?id=${vote.id}">删除投票</a>
<a href="voteitem_updatein.jsp(sun企业级应用的首选)?id=${vote.id}">修改选项</a>
</td>
</tr>
</c:foreach>
<?xml(标准化越来越近了) version="1.0" encoding="utf-8" ?>
<taglib xml(标准化越来越近了)ns="https://java.sun.com/xml(标准化越来越近了)/ns/j2ee"
xml(标准化越来越近了)ns:xsi="https://www.w3.org/2001/xml(标准化越来越近了)schema-instance"
xsi:schemalocation="https://java.sun.com/xml(标准化越来越近了)/ns/j2ee (标准化越来越近了)/ns/j2ee/web-jsp(sun企业级应用的首选)taglibrary_2_0.xsd"
version="2.0">
<description>vote function library</description>
<display-name>vote</display-name>
<tlib-version>1.0</tlib-version>
<short-name>vote</short-name>
<uri>;/uri>
<function>
<name>votetype</name>
<function-class>cn.hxex.vote.util.votefunction</function-class>
<function-signature>java.lang.string votetype(java.lang.string)</function-signature>
</function>
<function>
<name>pictype</name>
<function-class>cn.hxex.vote.util.votefunction</function-class>
<function-signature>java.lang.string pictype(java.lang.string)</function-signature>
</function>
<function>
<name>votetypeoptions</name>
<function-class>cn.hxex.vote.util.votefunction</function-class>
<function-signature>java.lang.string votetypeoptions(java.lang.string)</function-signature>
</function>
<function>
<name>pictypeoptions</name>
<function-class>cn.hxex.vote.util.votefunction</function-class>
<function-signature>java.lang.string pictypeoptions(java.lang.string)</function-signature>
</function>
</taglib>
上一篇: ASP 3.0高级编程(三)
下一篇: 适用于企业级别建站首选利器