简体   繁体   English

空自定义标签的JSP语法?

[英]JSP syntax for an empty custom tag?

What is the proper way of creating an empty custom tag in JSP? 在JSP中创建空的定制标记的正确方法是什么?

Is should have a prefix and suffix. 是应该有一个前缀和后缀。 An example would be TWONG prefix and GLOOP as suffix. 一个示例是TWONG前缀和GLOOP作为后缀。 Which choices are valid? 哪些选择有效?

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

A quick google search of "Empty custom tag in JSP" revealed zetcode.com: Custom JSP tags . 谷歌对“ JSP中的空自定义标签”的快速搜索显示了zetcode.com:自定义JSP标签

Their first code sample has the following in it: 他们的第一个代码示例包含以下内容:

<%@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>

The relevant items I see in there are taglib prefix="d" and <d:DateTag /> . 我在其中看到的相关项目是taglib prefix="d"<d:DateTag />

Since d is the prefix, I would assume the option of <PREFIX:SUFFIX/> is correct. 由于d是前缀,因此我认为<PREFIX:SUFFIX/>的选项是正确的。

So, option a. 因此,选项a。 <TWONG:GLOOP/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM