Java Reference
In-Depth Information
In addition, any HTML in your JSP uses the color settings defined for HTML files.
Likewise, scriptlets use the appropriate Java syntax font and foreground color
options, but their background color is controlled through the JSP settings. Both
sets of styles can be controlled through the Colors and Fonts settings window.
As you edit a JSP file, IDEA constantly checks the syntax of your JSP code for
errors. Any errors or warnings it detects appear in the error stripe, as they do in
the Java editor. In addition to checking Java syntax, the JSP editor also verifies
that (to the best of its knowledge) you're using the JSP tags correctly. This includes
making sure you've specified all the required attributes for each tag and that any
references to local variables and JavaBeans are valid.
The Code | Reformat code command ( Ctrl+Alt+L ) now has improved support
for JSP files. For scriptlets, the Java code style settings are used; otherwise the
HTML formatting settings from the Global Code Style settings come into play.
The structure view now supports JSP files as well. This gives you an easy way to
view and navigate the elements in the page. JetBrains has stepped up its structure
view in the new release, adding support for HTML , JavaScript, and CSS files.
Managing imports in JSP files
As in the Java editor, IDEA 's JSP editor automatically resolves any new class refer-
ences in your file and prompts you to import them. IDEA uses the import settings
from your code style to determine how classes are automatically imported into
your page. Of course, the JSP editor uses the JSP equivalent of the import state-
ment, the import attribute of the page directive. All the imports are appended to
the import list.
Conversely, in IDEA 5.0, Optimize Imports works on JSP s imports. Just
as it does in Java files, the Code | Optimize Imports command
( Ctrl+Alt+O ) throws out any unused import statements and organizes
the remaining ones according to your code style selections.
NOTE
Using JSP tag completion
IDEA 's JSP editor understands the directives defined by the Servlet API . It puts this
knowledge to good use by providing convenient completion of the commands
and all their attributes and attribute values. Basic code completion ( Code | Com-
plete Code | Basic , or Ctrl+Space ) and class name code completion ( Code |
 
 
 
 
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search