주의하세요, 实现적 방법必须是静态的
<%...@ taglib uri=" http://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 정렬="중앙">
<a href="vote_update.jsp?id=${vote.id}">修改投票</a>
<a href="<%=context %>/deleteVote.do?id=${vote.id}">删除投票</a>
<a href="voteitem_updatein.jsp?id=${vote.id}">修改选项</a>
</td>
</tr>
</c:forEach>
<?xml version="1.0" 인코딩="UTF-8" ?>
<taglib xmlns=" http://java.sun.com/xml/ns/j2ee "
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation=" http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptalibrary_2_0.xsd "
버전="2.0">
<description>투표 기능 라이브러리</description>
<display-name>투표</display-name>
<tlib-버전>1.0</tlib-버전>
<short-name>투표</short-name>
<uri>http://hxex.cn/vote</uri>
<기능>
<name>투표 유형</name>
<function-class>cn.hxex.vote.util.VoteFunction</function-class>
<function-signature>java.lang.String votetype(java.lang.String)</function-signature>
</function>
<기능>
<name>사진 유형</name>
<function-class>cn.hxex.vote.util.VoteFunction</function-class>
<function-signature>java.lang.String pictype(java.lang.String)</function-signature>
</function>
<기능>
<name>투표 유형</name>
<function-class>cn.hxex.vote.util.VoteFunction</function-class>
<function-signature>java.lang.String votetypeoptions(java.lang.String)</function-signature>
</function>
<기능>
<name>사진 유형 옵션</name>
<function-class>cn.hxex.vote.util.VoteFunction</function-class>
<function-signature>java.lang.String pictypeoptions(java.lang.String)</function-signature>
</function>
</taglib>
패키지 cn.hxex.vote.util;
공개 클래스 VoteFunction ...{
공개 정적 문자열 votetype(문자열 votetype)...{
return SelectConst.getVoteTypeTitle(votetype);
}
공개 정적 문자열 votetypeoptions(String defaultValue)...{
SelectConst.getVoteTypeOptions(defaultValue)를 반환합니다.
}
공개 정적 문자열 pictype(문자열 pictype)...{
return SelectConst.getPicTypeTitle(pictype);
}
공개 정적 문자열 pictypeoptions(String defaultValue)...{
SelectConst.getPicTypeoptions(defaultValue)를 반환합니다.
}
}
http://blog.csdn.net/daryl715/archive/2007/02/11/1507387.aspx