67,538
社区成员
发帖
与我相关
我的任务
分享
public class HelloWorldTag extends SimpleTagSupport {
@Override
public void doTag() throws JspException, IOException {
this.getJspContext().getOut().write("HelloWorld Tag");
}
}
<?xml version="1.0" encoding="ISO-8859-1" ?>
<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-jsptaglibrary_2_0.xsd"
version="2.0">
<tlib-version>2.0</tlib-version>
<short-name>mytag</short-name>
<uri>http://icon-man.blogbus.com/tag-bean</uri>
<tag>
<name>helloworld</name>
<tag-class>com.bjsxt.drp.tag.HelloWorldTag</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<%@ taglib prefix="mytag" uri="http://www.bjsxt.com/tag-bean" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
</head>
<body>
<mytag:helloworld></mytag:helloworld>
</body>
</html>