﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-liuzheng-文章分类-Tag develope</title><link>http://www.blogjava.net/liuzheng/category/26122.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 28 Sep 2007 06:35:08 GMT</lastBuildDate><pubDate>Fri, 28 Sep 2007 06:35:08 GMT</pubDate><ttl>60</ttl><item><title>自定义标签中控制逻辑的重要参数</title><link>http://www.blogjava.net/liuzheng/articles/148052.html</link><dc:creator>刘铮 </dc:creator><author>刘铮 </author><pubDate>Tue, 25 Sep 2007 06:37:00 GMT</pubDate><guid>http://www.blogjava.net/liuzheng/articles/148052.html</guid><wfw:comment>http://www.blogjava.net/liuzheng/comments/148052.html</wfw:comment><comments>http://www.blogjava.net/liuzheng/articles/148052.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/liuzheng/comments/commentRss/148052.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/liuzheng/services/trackbacks/148052.html</trackback:ping><description><![CDATA[自定义标签中控制逻辑的重要参数：<br />
在doStartTag()和doAfterBody()中用的到<br />
<br />
<br />
<code><strong>SKIP_PAGE</strong></code> ---表示以下的逻辑处理都不运行了<br />
<code><strong>SKIP_BODY</strong></code> ---表示不运行body中的逻辑处理了<br />
<code><strong>EVAL_PAGE</strong></code> ---表示继续进行java中的逻辑处理<br />
<code><strong>EVAL_BODY_INCLUDE</strong></code> ---表示将标签中的body内容输出出来。<br />
<code><strong>EVAL_BODY_BUFFERED</strong></code> ---表示创建了个新的buffer即BodyContent 并由他来开始处理body
<img src ="http://www.blogjava.net/liuzheng/aggbug/148052.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/liuzheng/" target="_blank">刘铮 </a> 2007-09-25 14:37 <a href="http://www.blogjava.net/liuzheng/articles/148052.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jsp中怎样调用tld</title><link>http://www.blogjava.net/liuzheng/articles/147986.html</link><dc:creator>刘铮 </dc:creator><author>刘铮 </author><pubDate>Tue, 25 Sep 2007 02:12:00 GMT</pubDate><guid>http://www.blogjava.net/liuzheng/articles/147986.html</guid><wfw:comment>http://www.blogjava.net/liuzheng/comments/147986.html</wfw:comment><comments>http://www.blogjava.net/liuzheng/articles/147986.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/liuzheng/comments/commentRss/147986.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/liuzheng/services/trackbacks/147986.html</trackback:ping><description><![CDATA[<p>jsp页面通过抬头的</p>
&lt;%@ taglib uri="/XXXX" prefix="st"%&gt;<br />
的uri 找到的<br />
uri是指向tld的，有两种方法指向tld<br />
一种是直接指向tld文件所在的位置，与tld中的uri的属性&lt;uri&gt;XXXX&lt;/uri&gt;一样<br />
另一种是间接指向tld文件位置：也就是指向一个/XXX，然后在web的配置文件中找到对应的<br />
&nbsp;&nbsp;&nbsp; &lt;taglib&gt;<br />
&nbsp; &nbsp;&lt;taglib-uri&gt;/XXX&lt;/taglib-uri&gt;<br />
&nbsp; &nbsp;&lt;taglib-location&gt;tld的地址&lt;/taglib-location&gt;<br />
&nbsp; &lt;/taglib&gt;<br />
这个时候在tld中就不需要进行&lt;uri&gt;的配置了
<img src ="http://www.blogjava.net/liuzheng/aggbug/147986.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/liuzheng/" target="_blank">刘铮 </a> 2007-09-25 10:12 <a href="http://www.blogjava.net/liuzheng/articles/147986.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JSP runtime engine使用tld的步骤</title><link>http://www.blogjava.net/liuzheng/articles/147966.html</link><dc:creator>刘铮 </dc:creator><author>刘铮 </author><pubDate>Tue, 25 Sep 2007 01:27:00 GMT</pubDate><guid>http://www.blogjava.net/liuzheng/articles/147966.html</guid><wfw:comment>http://www.blogjava.net/liuzheng/comments/147966.html</wfw:comment><comments>http://www.blogjava.net/liuzheng/articles/147966.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/liuzheng/comments/commentRss/147966.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/liuzheng/services/trackbacks/147966.html</trackback:ping><description><![CDATA[1 The JSP runtime reads a taglib directive at<br />
the top of the JSP, indicating that this page<br />
uses tags and where to find the TLD file for<br />
the tag library or libraries it uses.<br />
2 The JSP runtime next locates the TLD and<br />
reads all the information about the library<br />
from it.<br />
3 The TLD&#8217;s information is placed in instances of the helper classes.<br />
4 The runtime returns to reading the JSP. When it encounters a tag, it needs<br />
to validate its usage, meaning: (1) checking if it is indeed a tag defined in<br />
the TLD and (2) whether or not it is used properly (i.e., the tag has valid<br />
attributes and proper body type). The TLD also informs it of the tag handler<br />
class that implements this tag, in order for it to use that class in the<br />
servlet being produced.<br />
5 To validate the tag against the TLD, the runtime can make calls to the inmemory<br />
helper objects, instead of referring to the TLD.<br />
<br />
<br />
TLD的信息加载在TagLibraryInfo，TagInfo，TagAttributeInfo之中
<img src ="http://www.blogjava.net/liuzheng/aggbug/147966.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/liuzheng/" target="_blank">刘铮 </a> 2007-09-25 09:27 <a href="http://www.blogjava.net/liuzheng/articles/147966.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>有body和没有body的自定义标签的tld的区别</title><link>http://www.blogjava.net/liuzheng/articles/147857.html</link><dc:creator>刘铮 </dc:creator><author>刘铮 </author><pubDate>Mon, 24 Sep 2007 09:32:00 GMT</pubDate><guid>http://www.blogjava.net/liuzheng/articles/147857.html</guid><wfw:comment>http://www.blogjava.net/liuzheng/comments/147857.html</wfw:comment><comments>http://www.blogjava.net/liuzheng/articles/147857.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/liuzheng/comments/commentRss/147857.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/liuzheng/services/trackbacks/147857.html</trackback:ping><description><![CDATA[有body：&lt;bodycontent&gt;JSP&lt;/bodycontent&gt;&nbsp; 这里必须为JSP，表明这个标签中有内容 。 body是指的&lt;text&gt;dd&lt;/text&gt;,dd便为body<br />
没有body：&lt;bodycontent&gt;empty&lt;/bodycontent&gt; 
<img src ="http://www.blogjava.net/liuzheng/aggbug/147857.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/liuzheng/" target="_blank">刘铮 </a> 2007-09-24 17:32 <a href="http://www.blogjava.net/liuzheng/articles/147857.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>基本标签的开发</title><link>http://www.blogjava.net/liuzheng/articles/147808.html</link><dc:creator>刘铮 </dc:creator><author>刘铮 </author><pubDate>Mon, 24 Sep 2007 07:21:00 GMT</pubDate><guid>http://www.blogjava.net/liuzheng/articles/147808.html</guid><wfw:comment>http://www.blogjava.net/liuzheng/comments/147808.html</wfw:comment><comments>http://www.blogjava.net/liuzheng/articles/147808.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/liuzheng/comments/commentRss/147808.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/liuzheng/services/trackbacks/147808.html</trackback:ping><description><![CDATA[<p>基本标签必须要满足三个文件<br />
1。java文件 extends 有关Tag类<br />
2。tld文件 让JSP runtime 知道怎么用标签<br />
3。web中部署标签<br />
例子：<br />
package book.simpletasks;<br />
import java.io.IOException;<br />
import javax.servlet.jsp.PageContext;<br />
import javax.servlet.jsp.JspException;<br />
import javax.servlet.jsp.JspTagException;<br />
import javax.servlet.jsp.tagext.TagSupport;<br />
public class HelloWorldTag<br />
extends TagSupport {<br />
public int doStartTag()<br />
throws JspException<br />
{<br />
try {<br />
pageContext.getOut().print("Hello JSP tag World"); d<br />
} catch(IOException ioe) { e<br />
throw new JspTagException("Error:<br />
IOException while writing to the user");<br />
}<br />
return SKIP_BODY;<br />
}<br />
}<br />
<br />
&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;<br />
&lt;!DOCTYPE taglib<br />
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"<br />
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"&gt;<br />
&lt;taglib&gt;<br />
&lt;tlibversion&gt;1.0&lt;/tlibversion&gt;<br />
&lt;jspversion&gt;1.1&lt;/jspversion&gt;<br />
&lt;shortname&gt;simp&lt;/shortname&gt;<br />
&lt;uri&gt; <span style="color: #000000">http://www.manning.com/jsptagsbook/simple-taglib </span>&lt;/uri&gt;--------------这里可以不要<br />
&lt;info&gt;<br />
A simple sample tag library<br />
&lt;/info&gt;<br />
&lt;tag&gt;<br />
&lt;name&gt;hello&lt;/name&gt;<br />
&lt;tagclass&gt;book.simpletasks.HelloWorldTag&lt;/tagclass&gt;<br />
&lt;bodycontent&gt;empty&lt;/bodycontent&gt;<br />
&lt;info&gt;<br />
Say hello.<br />
&lt;/info&gt;<br />
&lt;/tag&gt;<br />
&lt;/taglib&gt;</p>
<p>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;<br />
&lt;!DOCTYPE web-app<br />
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"<br />
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd"&gt;<br />
&lt;web-app&gt;<br />
&lt;taglib&gt;<br />
&lt;taglib-uri&gt;<br />
<span style="color: red">http://www.manning.com/jsptagsbook/simple-taglib</span><br />
&lt;/taglib-uri&gt;<br />
&lt;taglib-location&gt;<br />
/WEB-INF/simpletags.tld<br />
&lt;/taglib-location&gt;<br />
&lt;/taglib&gt;<br />
&lt;/web-app&gt;</p>
<p><br />
使用时在jsp中加入<br />
&lt;%@ taglib<br />
uri="<span style="color: red">http://www.manning.com/jsptagsbook/simple-taglib</span>"<br />
prefix="jspx" %&gt;<br />
<br />
<br />
注意红色的部分要一一对应<br />
保证在jsp页面装载的时候找得到tld文件</p>
<img src ="http://www.blogjava.net/liuzheng/aggbug/147808.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/liuzheng/" target="_blank">刘铮 </a> 2007-09-24 15:21 <a href="http://www.blogjava.net/liuzheng/articles/147808.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>