 |
|
|
|
 |
 |
 |
Speeding
JSP Development Using HomeSite
HomeSite
is one of the most popular Web site development tools available
today; however, it does not provide integrated support for
Java Server Pages (JSP)1. This
article describes the steps for combining the features of
HomeSite and JRun and to create a JSP Integrated Development
Environment (IDE).
Using JRun to View JSP within HomeSite
One of the most helpful features of HomeSite is the ability
to quickly preview an HTML page as it would be displayed
by a user's browser. But HomeSite lacks the ability to dynamically
view pages containing JSP directives. If you attempt to
browse a page containing JSP, the page is rendered incorrectly.
HomeSite can be extended to display JSP by using JRun.
To configure your HomeSite server mappings to use JRun,
execute the following steps from within HomeSite:
Click the Options/Settings menu or press F8.
Click the Browse tab (Figure 1).
Ensure that the Enable server mappings checkbox is selected.
Click the Add button.
In the Map From field, enter the physical path of the
directory that will correspond to the URL value of the Map
To field.
In the Map To field, enter the URL that displays the
filename entered in the Map From field.
Click the OK button.
Figure 1: Entering Server Mapping (Browse
Tab)
Added Advantages: Browsing your JSP within
the HomeSite IDE will reduce the number of windows opened
on your desktop and reduce your likelihood of Carpal Tunnel
Syndrome by saving you from the old routine of Alt+Tab,
F5.
Recognizing JSP/Java Filename Extensions
The next step is to tell HomeSite that filenames ending
in .jsp, .jsa, and .java should be considered web documents
and treated as such in the file dialogs. By default, HomeSite
does not recognize filenames ending in .jsp, .jsa, and .java
as web files. It therefore shows these filenames only if
you select "All files" as the "Filter" option in the Explorer-like
section of the Resource window pane (the left-most pane).
As shown in Figure 2, the other Filter options are Web Documents
(text only), Web Images (images only), and All Web Files
(text and images).
Figure 2: Available HomeSite File Filters
To configure HomeSite to qualify the .jsp, .jsa, and .java
extensions as web documents for viewing and editing, proceed
with the following:
Click the Options/Settings menu or press F8.
Click the File Settings tab (Figure 3).
In the Web Documents field, cursor to the end of the list
and add "jsp;jsa;java;".
Click the OK button.
Figure 3: Adding New File Extensions to Web
Documents List
Viewing JSP Code with a Color Scheme
Now that you have the .jsp, .jsa, and .java
filenames recognized as web documents, it's time to customize
the color scheme used while editing these files. By default,
the .jsp, .jsa, or .java page will have only HTML tags/attributes
and JavaScript colorized, along with everything between
the JSP delimiters (
<% %>
) highlighted in yellow (*ack*). With color schemes applied,
JSP-formatted pages will have only the delimiters highlighted
in yellow (Figure 4); and because of similar objects between
JSP and ASP, keywords such as "Response", "Request", "Session"
will have a purple color applied to them. Java pages will
have keywords such as "import", "public", "extends", "for",
"switch", "int" in blue bold and "//" comments in green
italics.
Figure 4: JSP Code in Color
Whereas HomeSite does not offer actual jsp/jsa/java syntax
"color coding" at the time of this writing1,
we can assign the closest scheme available as follows:
Click the Options/Settings menu or press F8.
Click the Color Coding tab (Figure 5).
Choose either ASP-JScript or ASP-VBScript.
Click the Edit Extensions button.
At the end of the list, enter "jsp;jsa;".
Click the OK button.
Choose JavaScript.
Click the Edit Extensions button.
At the end of the list, enter "java;".
Click the OK button.
Click the OK button again.
Figure 5: Adding New Color Coding Extensions
Creating JSP Code Snippets
The last step is to create easy-access JSP Code Snippets.
The Code Snippets feature offers a quick way to store and
re-use code blocks and content. Comment your snippets as
you would any code block.
To create a code snippet, execute the following steps.
(These instructions are excerpts from the HomeSite help
file entitled "Saving Code Blocks as Snippets.")
In the Resource pane, click the Snippets icon.
Right-click in the pane and choose Create Folder from
the shortcut menu.
Enter a name for the folder.
Right-click in the pane and choose Add Snippet to open
the Snippet dialog (Figure 6).
Enter a name for the snippet in the Description box. Note
that snippet names cannot contain characters that are illegal
in filenames (slashes, special characters, double quotes,
etc.).
In the Start Text window, type in or paste an opening
code block. To set a default spacing between the blocks,
press the Enter key at the end of the start text and at
the beginning of the end text.
In the End Text window, enter a closing code block.
Click the OK button.
To edit or delete a snippet, right-click it.
The default location for Snippets is the \UserData\Snippets
folder below your HomeSite root directory.
Figure 6: Adding Code Snippets
1 A Java Server Pages Color Coding
Scheme is now available in the HomeSite
4.0.1 update.
|
|
|
|
|
|
|