Java Reference
In-Depth Information
In case of a separate .tld file, make sure that its containing folder is regis-
tered in the
Web Resource Directories
list and mapped to the /
WEB-INF
deployment directory or one of its subfolders.
■
In case of a
JAR
, once it's added to the Classpath,
IDEA
resolves all refer-
ences to the tag library and provides appropriate code completion and
highlighting. But for the deployment purposes (to avoid possible runtime
errors), you may need to specify packaging method and deployment path
for that
JAR
in the
Modules and Libraries to Package
list.
■
In rare cases, when you have the accompanying .tld file detached from its
JAR
, you need to configure references for file and
JAR
separately, as
described earlier.
■
IDEA
5.0 supports the new
JSP
2.0 tag files format. This format makes it easy to
add new tags without writing a line of Java code, mucking with the
TLD
, and so
forth.
IDEA
can locate your tags through the direct reference to their containing
folder in the
tagdir
attribute of the
taglib
directive.
IDEA
supports both the
scriptlet-based .tag and
XML
.tagx formats. The editor assists you in including
these through code completion and identifies invalid usage or syntax errors.
IDEA
5.0 fully supports the
XML
version of
JSP
files known as
JSP
documents
,
which have the file extension .jspx, including those features of the format new to
JSP
2.0. In
JSP
documents, a
JSP
is represented as well-formed
XML
code, and any
embedded
HTML
must be well-formed
XHTML
. When you're working in
JSPX
documents, you have both the benefits of
IDEA
's
XML
editing features as well as
the Java code completion and other aspects of the traditional
JSP
editor.
JSPX
documents have their own file type designation and code style settings.
This
TLD
file, which describes the tags in the library and defines their attributes,
can be located by
IDEA
through a variety of means defined in the
JSP
specifica-
tion. We'll describe the most common ones momentarily.
When you use a tag library in
JSP
, you must specify the tag library's
URI
and its
prefix on each
JSP
page in which you wish to use it. Both direct and indirect
URI
references can be used, as shown in the following examples:
<%@ taglib uri="my_descriptor.tld" prefix="descriptor" %>
IDEA
looks for my_descriptor.tld file in all web resource directories that are
mapped to the deployment directory /
WEB-INF
.