Java Reference
In-Depth Information
IDEA
lets you select from the four scopes allowed by
JSP
: application, request,
page, and session (request is the default).
Once a JavaBean is placed in scope, the editor can also perform completions
when using the
<jsp:getProperty>
and
<jsp:setProperty>
tags. These tags
require that you specify the reference name of the JavaBean you wish to access.
The editor completes the name for you, allowing you to select from all the Java-
Beans made available through
JSP
tags. If you use a name that isn't available in
the current context,
IDEA
flags this as an error.
JavaBean properties are determined through a set of naming conventions
(the familiar getter and setter methods). When you perform a code completion
on the
property
attribute of either the
<jsp:getProperty>
or
<jsp:setProperty>
tag,
IDEA
uses these conventions to provide a list of valid property names. Addi-
tionally, you can visit the source behind these properties (if the code is in your
project's source path) through the
Go To | Declaration
command (
Ctrl+B
),
and you can view their JavaDoc with
Ctrl+Q
(
View | Quick JavaDoc
).
The
JSP
2.0 expression language (
EL
) is fully supported by
IDEA
's code comple-
tion and validation features in version 5.0. But note that, because
EL
has dynamic
nature, only statically known info is highlighted and completed.
Custom and third-party tag libraries
IDEA
also has the ability to perform syntax checking and code completion on cus-
tom
JSP
tags. Support for standard
JSP
tags like
<jsp:getProperty>
and
<jsp:use-
Bean>
is automatic, with no additional setup necessary. For custom tag libraries
you've developed yourself, and for third-party libraries such as
JSTL
or Struts,
you must take a few initial steps. For
IDEA
to provide completion and syntax
checking on your tag libraries, it has to know where to find them.
First, your tag library's class files must be part of the module's Classpath.
This is achieved either automatically (if you have the library's sources under
the module sourcepath) or manually by adding the library's
JAR
file to the
module
Libraries
.
IDEA
must also be able to find your tag library descriptor (
TLD
), which can
either be represented as a separate .tld file or be part of the
JAR
. Depending on
your case, the necessary settings differ, but they all can be configured in the Web
Module Settings tab of the Paths dialog (covered earlier in this chapter):