简体   繁体   中英

JSP syntax for an empty custom tag?

What is the proper way of creating an empty custom tag in JSP?

Is should have a prefix and suffix. An example would be TWONG prefix and GLOOP as suffix. 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 .

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 /> .

Since d is the prefix, I would assume the option of <PREFIX:SUFFIX/> is correct.

So, option a. <TWONG:GLOOP/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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