当前位置:编程学习 > JS >>

使用静态类实现JSP自定义标签

注意,实现的方法必须是静态的

<%...@ 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 align="center">
                  <a href="vote_update.jsp(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="http://java.sun.com/xml(标准化越来越近了)/ns/j2ee"
    xml(标准化越来越近了)ns:xsi="http://www.w3.org/2001/xml(标准化越来越近了)Schema-instance"
    xsi:schemaLocation="http://java.sun.com/xml(标准化越来越近了)/ns/j2ee http://java.sun.com/xml(标准化越来越近了)/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>http://hxex.cn/vote</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>
 

补充:Web开发 , Jsp ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,