⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.xtp

📁 RESIN 3.2 最新源码
💻 XTP
字号:
<document><header><product>resin</product><version>Resin 3.0</version><type>tutorial</type><title>Tag Files</title><description><p>JSP 2.0 introduces XML-based tag files.  Instead of having to writeJava code for custom tags, applications can use XML or JSP syntax fortheir tags.  Tag files do not require .tld files,making development simpler.</p></description><tutorial-startpage>test.jsp</tutorial-startpage></header><body><summary/><s1 title="Files in this tutorial"><deftable><tr><td><viewfile-link file="test.jsp"/>    </td><td>The jsp page that uses the tags</td></tr><tr><td><viewfile-link file="WEB-INF/tags/test.tagx"/>    </td><td>The basic tag.</td></tr></deftable></s1><s1 title="The tag file"><p>Tag files in JSP 2.0 look and run like normal JSP files with some extradirectives.  This example definine a tag attribute "a" whichtakes a <code>String</code> value.  It prints a simple message.</p><example title="WEB-INF/tags/test.tagx">&lt;jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"&gt;  &lt;jsp:directive.attribute name="a"                           type="java.lang.String"                           required="true"/&gt;  &lt;jsp:text&gt;A sample tag: ${'${'}a}&lt;/jsp:text&gt;&lt;/jsp:root&gt;</example><p>The <var>.tagx</var> extension identifies the tag as a JSP tag fileusing XML syntax.  The example could also have used <var>test.tag</var> fora tag file in JSP syntax.  Tag files normally belong in WEB-INF/tags,although the location is configurable.</p><p>The tag example uses the JSP 2.0 Expression Language as an example andas a way to avoid any Java in the tag file.  The <code>${"${"}a}</code>tells the tag to look in the <code>pageContext</code> for a localvariable <code>a</code>.  The value of <code>a</code> is assigned bythe tag attribute as defined in the attribute directive.</p></s1><s1 title="Using the tag file"><p>Using tag files is similar to using normal JSP tags.  This exampleuses the XML syntax, although normal JSP syntax would work, too.The namespace prefix <var>urn:tagfiledir:</var> tells JSP where to lookfor the tag.  In  this case it will look in WEB-INF/tags.</p><example title="test.jsp">&lt;jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"          xmlns:tags="urn:jsptagdir:/WEB-INF/tags"&gt;  &lt;tags:test a="Test 1"/&gt;&lt;br/&gt;  &lt;tags:test a="Test 2"/&gt;&lt;/jsp:root&gt;</example><results>A sample tag: Test 1&lt;br&gt;A sample tag: Test 2</results></s1></body></document>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -