首页 > 编程 > JSP > 正文

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

2024-09-05 00:17:02
字体:
来源:转载
供稿:网友

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

<%...@ taglib uri="http://hxex.cn/vote" prefix="vote" %>


${vote.name}
${vote.title}
${vote:votetype(vote.votetype)}
${vote:pictype(vote.pictype)}

修改投票
/deleteVote.do?id=${vote.id}">删除投票
修改选项



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-jsptaglibrary_2_0.xsd"
version="2.0">
vote function library
Vote
1.0
vote
http://hxex.cn/vote


votetype
cn.hxex.vote.util.VoteFunction
java.lang.String votetype(java.lang.String)



pictype
cn.hxex.vote.util.VoteFunction
java.lang.String pictype(java.lang.String)



votetypeoptions
cn.hxex.vote.util.VoteFunction
java.lang.String votetypeoptions(java.lang.String)



pictypeoptions
cn.hxex.vote.util.VoteFunction
java.lang.String pictypeoptions(java.lang.String)



package cn.hxex.vote.util;

public class VoteFunction ...{
public static String votetype(String votetype)...{

return SelectConst.getVoteTypeTitle(votetype);
}
public static String votetypeoptions(String defaultValue)...{
return SelectConst.getVoteTypeOptions(defaultValue);
}
public static String pictype(String pictype)...{
return SelectConst.getPicTypeTitle(pictype);
}
public static String pictypeoptions(String defaultValue)...{
return SelectConst.getPicTypeoptions(defaultValue);
}
}
http://blog.csdn.net/daryl715/archive/2007/02/11/1507387.aspx

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表