空自定义标记的JSP语法?

时间:2015-10-12 17:52:47

标签: java jsp tags

在JSP中创建空自定义标记的正确方法是什么?

应该有前缀和后缀。一个例子是TWONG前缀和GLOOP作为后缀。哪些选择有效?

a) <TWONG:GLOOP/>
b) <GLOOP:TWONG/>
c) <TWONG:GLOOP><TWONG:GLOOP/>
d) <GLOOP:TWONG><GLOOP:TWONG/>

1 个答案:

答案 0 :(得分:0)

在JSP&#34;中快速谷歌搜索&#34;清空自定义标签透露zetcode.com: Custom JSP tags

他们的第一个代码示例包含以下内容:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="d" uri="http://zetcode.com/tlds/date" %>

<html>
...
    <body>
        <h2>Date</h2>
        <b>Today's Date: </b> <d:DateTag />
    </body>

我在其中看到的相关项目有taglib prefix="d"<d:DateTag />

由于d是前缀,我认为<PREFIX:SUFFIX/>的选项是正确的。

所以,选项a。 <TWONG:GLOOP/>