Compiling a JSP File
See Also
When you compile a JSP file you can detect syntax problems
before you execute the file on a server. Compilation also
translates the JSP file into a servlet. Therefore, compilation
discovers syntax errors that occur at translation time and at compile time. If
a JSP file references a tag file, the referenced tag file is compiled with the JSP file.
To compile a JSP file:
- Do one of the following:
- Compile a single file.
In the Projects window, right-click the JSP file and choose Compile
File (F9) from the pop-up menu.
- Compile selected files.
In the Projects window, use the Ctrl key and the Shift key to select the files
that you want to compile, right-click the selection and choose Compile
File (F9) from the pop-up menu.
- Compile all JSP files in a project.
In the Projects window, right-click the project node, choose Properties,
click Compiling, and select the Test compile all JSP files during builds checkbox.
Close the Project Properties dialog box, right-click the project node, and choose
Build from the pop-up menu.
|
By default, the IDE does not compile JSP files while building a project. This is because
JSP compilation can take a long time because JSP files have to be translated to servlets
before they can be compiled. |
- In the Output window, click an error to jump to the source of the error
in the Source Editor.
Troubleshooting
The following list shows some typical compilation messages
and possible solutions:
- Invalid expression. Might be caused by an unmatched curly brace ({).
Look for EL syntax highlighting that extends past the EL expression. If the
ending brace is missing, the Source Editor automatically highlights the next
beginning brace as an error. When you select a brace, the Source Editor highlights
the matching brace.
- Missing equal symbol. This error can be caused by a missing quote
mark ("). Look for code that has the same color as the text or text
that has the same color as the code. Look for tag highlighting that extends
past the tag's end delimiter.
- Missing mandatory attribute. Might be caused by a misspelled attribute.
Use the code completion feature to verify the correct spelling.
- Unterminated tag. Can be caused by a missing percent sign (%)
in the directive's closing delimiter. Look for an end delimiter. that is a
different color from the start delimiter.
- Tag must be empty. Check for a missing forward slash (/)
in the tag's closing delimiter.
Forgetting to delimit EL expressions with curly braces ({}) is a common
error that cannot be caught through compilation, because the text is valid syntax.
To catch this type of error, look for expressions that are not highlighted with
the color used for EL expressions.
If you see a the following compilation output, there might be an internal cache
problem. You might need to reboot the IDE to be able to compile the JSP file.
java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/SimpleTagSupport
- See Also
- About JSP Syntax
- Editing a JSP File
- Viewing the JSP's Servlet
- About Debugging and Testing Web Applications
Legal Notices