From the [New] wizard, select [Web] > [JSP], and the wizard generates the JSP file. Refer to the following for the wizard settings:
Enter or select the parent folder
Select the folder in which the JSP file is to be created.
File name
Specify the name of the JSP file to be created. If the extension is omitted, ".jsp" is used as the extension.
Use JSP Template
Select the checkbox if you want to use a template to create the JSP file. New templates can also be added.
Point
For files that are meant to be fetched by another JSP file using an include directive (<%@ include file="..."%>) or similar, rather than being invoked directly as JSP, do not use ".jsp" as the extension. Use an extension such as ".jspf" for such files.
If the extension is omitted, the extension that is used, and the embedded encoding used during file creation, can be customized using [Web] > [JSP Files] on the preferences page.
Use the JSP editor to edit a JSP file. The JSP editor is a text editor that has the following features:
Highlighted display of syntax
Element names, attribute names, attribute values, comments, and so on, are each highlighted in different colors. The highlighting method can be customized using preferences.
Problem identification
If there are errors in the entered tags, attribute names, attribute values, or similar, errors and warnings are indicated by lines markers or wavy lines in the text.
Contents Assist
Depending on the cursor position, suggestions concerning selectable element names, attribute names, attribute values and so on are displayed in Contents Assist. Press the [Ctrl+Space] keys together to display the Contents Assist list, and enter characters to reduce the number of possible choices.
Tool tips display
When the cursor is moved over an element name or attribute name and the [F2] key is pressed, a description of that element or attribute is displayed.
User-definable templates and snippets
The templates that can be used with Contents Assist can be registered.
In addition, fragments of code or similar that are used frequently can be registered in snippets, thus enabling drag-and-drop to be used to easily insert code.
Tag selection
Depending on the cursor position, an indicator showing the range covered by a tag is displayed in the vertical ruler on the left-hand side of the page.
Use the appropriate view from the following when editing using the JSP editor:
Outline view
Shows the JSP syntax outline. Elements and attributes can also be added using this view.
Properties view
Shows the attributes of an element selected using the editor. The value can also be changed. Attribute values can also be selected from a list.
Snippets view
Fragments of code that are used frequently can be registered, thus enabling drag-and-drop to be used to easily insert code in the source.
JSP editor operation is the same as for the HTML editor. Refer to "2.3.3.2 Editing the HTML File".
If you are setting JSP extended tags that will be needed during Web application operation, JSP extended tags are displayed in the Contents Assist list. For this, use the following procedure:
Specify the JSP tag library location.
Use one of the following methods to specify the tag library:
Code the taglib tag in web.xml, and specify the .tld file location.
Place the .tld file in /WEB-INF.
Place the JAR file in WEB-INF/lib. The JAR file contains the tld file that is stored in the /META-INF.
Code a taglib directive in the JSP file.
To display JSP extended tags in the Contents Assist list, code a taglib directive in the JSP file.
To code a taglib directive, select the template "JSP taglib directive" from Contents Assist. Contents Assist can be used even when entering uri attribute values. In addition, if the taglib uri is specified in the uri attribute, Contents Assist can be used to input the prefix attribute value, and the default prefix specified in taglib is displayed in the Contents Assist list.
Note
The tag configuration may collapse and an error may occur if a JSP file meeting the condition below is opened using the JSP Editor and [Source] > [Format] is executed from the menu. Use a Web Page Editor to execute [Format] with a JSP file that uses JavaScript.
An attribute for JavaScript is described within a tag, and JavaScript is used (Example: onclick attributes, and so on).
Attributes added using JSP2.1 (such as trimDirectiveWhitespaces) and specified in the JSP file will not be recognized (a warning will be displayed in the Problems view), but will not cause any errors.
The validators available for verifying JSP are the JSP syntax validator and the JSP content validator. For details on validation, refer to "6.2.5.2 Validation".
Note
The validators do not check for correct correspondence between JSP start tags and end tags. Thus, errors and warnings are not output in the Problems view. However, lack of correspondence between start tags and end tags may result in errors being detected during compilation of Java code converted from the JSP file.