BBJSP Simple Tags (Deprecated)
The BBJSP system is deprecated. For new development, use BBxServlet.
Description
BBJSP allows developers to create reusable page elements called tags. Tags are fragments of BBJSP mark-up that can be embedded into other BBJSP Pages. They receive parameters and render content.
Developing a Tag
Custom tags look like BBJSP pages in that they contain BBJSP mark-up and are processed to generate the HTML that will be sent to the client. They are distinguished from normal pages by their extension; rather than using .bbjsp you should use .tag.
A custom tag file may require inputs which are defined with the <%@ attribute /%> directive.
Here is a simple hello.tag that requires the attribute name to be specified.
<%@ tag extends="BaseTag"%><%@ attribute name="name" type="BBjString" required='true' %><div class="helloWrap"> Hello ${name}, have a nice day.
</div>
Using a tag:
Any BBJSP page can use a tag file to render content. This is particularly useful where content such as page headers and footers is concerned as you need to define the mark-up only once.
When you use the tag file, you should include the tag folder with a prefix and pass the name attribute to the tag file. If you omit the name attribute then because it's required the page will not be generated and you will receive an error response.
<%@ taglib tagdir="/WEB-CFG/tags/core" prefix='tags' %>
...
<tags:hello name='Fred Bloggs />
Directives
A directive affects the overall structure of the generated code. It usually has the following form:
Following is the syntax of JSP Expression:
<%@ directive attribute="value" %>
There are three directive as follows:
Directive |
Description |
||||||
---|---|---|---|---|---|---|---|
<%@ tag ... %> |
defines tag-dependent attributes, such as content-type and encoding used or the parent class which the page extends. The following attributes are supported
|
||||||
<%@ use ... %> |
tells the code generator to generate a USE statement The following attributes are supported
|
||||||
<%@ attribute ... %> |
defines an input attribute to a custom tag. See Simple Tags |