Span taglib ver. 1.2

    Custom JSP taglib. Tag span lets you define in JSP page an analogue for HTML span tag. Tag mimics the HTML <span> tag (or .NET <span runat=server> tag) and can be used to logically group text together into sections, paragraphs, pages, or sentences. So rather than using out.println() calls to write the output you can set for example properties for defined element (e.g. innerHtml etc.). For example:
 


<%@ taglib uri="taglib.tld" prefix="s" %>

<s:span id="myId">Here is some <b>interesting</b> text</s:span>

Of course, your original content could be even empty: <s:span id="myId"/>

Now you may read/write properties for described element. For example:

<s:innerText id="myId"/> will print the following: Here is some interesting text
<s:innerHtml id="myId"/> will print the following: Here is some <b>interesting</b> text
<s:outerText id="myId"/> will print the following: Here is some interesting text
<s:outerHtml id="myId"/> will print the following: <span id="myid">Here is some <b>interesting</b> text</span>

Notice that innerText and outerText return the same thing. However, there is a big difference between them. If you set innerText, it replaces the text inside the layer (the innerText of the layer), but if you set outerText, it replaces the whole layer (the outside of the layer) so that it doesn't exist anymore. For the most part, you will just use innerHTML.

You can use the same set of tags for writing new content. E.g.:

<s:innerHtml id="myId">Here is even more <i>interesting</i> text</s:innerHtml>

Tags are:

span

Body tag implements an anlogue for HTML span tag. Parameters are:

1) id describes an id for element
2) style Optional parameter. Describes your own CSS style
3) className Optional parameter. Describes your own CSS class for this element

innerText

Body tag lets you read (if body is empty) or write innerText property. Parameters are:

1) id describes an id for element

innerHtml

Body tag lets you read (if body is empty) or write innerHtml property. Parameters are:

1) id describes an id for element

outerText

Body tag lets you read (if body is empty) or write outerText property. Parameters are:

1) id describes an id for element

outerHtml

Body tag lets you read (if body is empty) or write outerHtml property. Parameters are:

1) id describes an id for element

for downloading:

Library: spantag.jar    Description: taglib.tld

© Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.