jsp自定义标签开发
不处理体内容的标签理解一下图片1
处理体内容标签理解提图片2
1:JspWriter out = pageContext.getOut();
2:BodyContent bc = this.getBodyContent();
3:String input = bc.getString();
4:JspWriter out = bc.getEnclosingWriter();
不处理体内容
第一行代码为不处理标签体内容时拿到需要的输出到页面的对象
处理体内容
第二行代码为处理标签提内容时拿到包装了提内容信息的对象
第三行代码为拿出体内容。
第四行为拿到页面输出对象。
拿到对象后用out.print方法输出处理后的效果给页面
编写标记配置tld文件:
<?xml version="1.0" encoding="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-jsptaglibrary_2_0.xsd"
version="2.0">
<description>test tag</description>
<tlib-version>1.0</tlib-version>
<short-name>util</short-name>
<uri>/timeTage</uri>
<tag>
<description>fist tag</description>
<name>Showtime</name>
<tag-class>com.test.tag.TimeTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<description>dateformat</description>
<name>formatTime</name>
<tag-class>com.test.tag.TimeFormat</tag-class>
<body-content>empty</body-content>
<attribute>
<name>date</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>pattern</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attri
相关文档:
jsp页面使用struts2的property标签输出如下内容
<s:property value="detailinfo"/> 其中,detailinfo="<strong>abc</strong>";
好像没事,问题出现了,在jsp页面上显示出了<strong>abc</strong>
一看页面源码,发现,源代码中已经变成了
< strong&a ......
JSP新闻发布系统android行动网
此网站的演示地址为:http://www.androidgo.cn
测试网址: http://ja00028.j01.netjsp.com
下载地址::http://download.csdn.net/source/1653791
技术实现:采用JSTL标签,基于servlet,jdbc开发。使用mysql数据库。
设计优势:一切技术使用最底层的,没有使用ssh框架,可以在任何国内的js ......
<script language="javascript">
var times=6;
clock();
function clock()
{
window.setTimeout('clock()',1000);
times=times-1;
time.innerHTML =times;
}
</script>
<head>
<meta http-equiv= "Refresh" content= "5;url=index.jsp "& ......
为了减轻服务器压力,将原来的文章管理系统由JSP文件的从数据库中取数据显示改为由jsp生成静态html文件后直接访问html文件。首先应创建一个模板文件,文件名和文件后缀可以随意,但我一般常用的还是 *.template ,因此,这里就以 template.template 为例( 将模板文件放入 /WEB-INF/templates/ 文件夹下 ):下面是一个简单的 ......