NetBeans: web
Requirements
Version: 0.1
Author: Petr Jiricka, Sun Microsystems/NetBeans
- Abstract:
- This document briefly describes the requiremnts for the web module. This module adds support for JSP (JavaServer Pages technology) into the IDE.
The supported version of the JSP specification is 1.1.
The main areas of the JSP support are editing in the code editor, syntax checking by compilation from the IDE and test run using the "Execute" action.
- Document History:
- [07-Aug-2000] : version 0.1 : Initial revision
- Contents:
- 1. Representation of JSP objects
- 2. JSP Editor
- 2.1 Syntax colorizing
- 2.2 Code completion
- 2.3 Abbreviations
- 3. JSP syntax checking by compilation
- 4. Execution (test run)
The module supports development JSPs by the Servlet 2.2/JSP 1.1 specifications.
JSP files are represented by a special node in the Explorer. The Explorer displays a hierarchy of files,
which comprise a web application. A filesystem may correspond to a web application, so the user's view in the explorer
is consistent with the general principles of web application developent.
JSP objects have properties which capture some characteristics of JSPs: The "Encoding" property characterizes
encoding of the JSP file and is used for further processing of the JSP. The "Content Language" and "Scripting Language"
properties are used by other parts of the module, such as correct syntax colorizing and code completion, or determining which
browser should be used for displaying this page.
JSP objects can be created using the "New..." action. There are individual templates for each possibe
content language of a JSP.
JSP Editor act as a JSP-specific extension of the IDE text editor. The goal is that features available for editing Java
files should be available for JSP as well: syntax colorizing, code completion, and in the future, some other features
such as "Go to declaration", matching element highlighting, symbol help etc.
Different areas of JSP pages are colored differently based on the part of the page they belong to.
There are three major parts:
- JSP tags, directives and comments
- Sections of the scripting language (usually Java): scriptlets, declarations and expressions
- Sections of the content language (HTML, but also XML, WML etc.)
These major parts are distinguished from each other by different background color. Lexical elements within one part
are also distinguished from each other - by font, color etc. The colorizing should be able to handle any
scripting or content language.
The editor provides a window containing a list of possible choices for the current position of caret in the text.
This window takes into account all possible choices for all the content language, scripting language and JSP tags
and directives. For example, after the
< symbol, the window should display available HTML tags,
and available JSP tags (including custom tags).
The completion window should pop up automatically when appropriate (i.e. when the user types an opening <
in content language block or a dot - . - in a Java block).
The JSP editor provides abbreviations for fast typing of JSP code, i.e. "jsps " generates
<jsp:setProperty name=". In the future the abbreviations should also work for scripting and
content code, i.e. "sout " in a Java block.
The completion window should pop up automatically when appropriate (i.e. when the user types an opening <
in content language block or a dot - . - in a Java block).
JSP module allows the user to quickly discover errors in a JSP page by the "Compile" action. This action attempts to
translate the page into servlet source and then compile the servlet, as would an actual web server which runs the page.
Any errors discovered during compilation are shown in the compiler output window. The user can quickly find the location
of the error by double-clicking it.
During the compilation, some other files related to the current JSP may be compiled as well. For example,
all JavaBeans used by the page are compiled. The user can also choose to automatically compile the error page for this
page, and pages used by this page through <jsp:include> and <jsp:forward>.
Also, tag handlers for all custom tags used by the page should be compiled.
JSPs can be executed directly from the IDE by the "Execute" and "Execute (restart server)" actions.
The "Execute" action launches the Tomcat server as an external process (if it is not already running)
and displays a web browser with a URL of the executed JSP. The "Execute (restart server)" is different
in that it always shuts down the running instance of the server and starts a new one.
There are some details important to the Tomcat implementation:
- If a JSP was compiled to a class file in the IDE, Tomcat uses the IDE-generated class file.
- When Tomcat encouters a JSP page, which is not compiled or is not up to date, it calls the IDE to compile it,
instead of calling its internal compiler.
- Tomcat's configuration file (server.xml) is auto generated by the execute action.
The web browser used by the IDE to view JSPs can be set either to the built-in web browser or to any external browser.