Java Reference
In-Depth Information
The following steps create a new JavaServer Page in TextPad.
To Create a New JavaServer Page in TextPad
1. Click the New Document button on the Standard toolbar. If necessary,
click Line Numbers on the View menu to display line numbers.
2. Click File on the menu bar and then click Save As on the File menu.
When the Save As dialog box is displayed, click the Save in box arrow
and then click 3 1 2 Floppy (A:) in the Save in list.
3. Double-click the Chapter12 folder or the location specified by your
instructor.
4. Type mainForm.jsp in the File name text box and then click JavaServer
Page (*.jsp) in the Save as type list. Click the Save button in the Save As
dialog box. If you did not install a JSP syntax file for TextPad, you will
have to select All Files (*.*) in the Save as type list.
5. Enter lines 1 through 28 as shown in Figure 12-65 on the previous page.
In the comments, insert your own name as programmer and enter the
current date.
TextPad displays the code for the initial comments, head, title, and
script tags, and the JavaScript user-defined function, checkSymbol()
(Figure 12-66). The color used for syntax highlighting of your code may
differ, depending on your configuration for this file type (*.jsp).
mainForm.jsp
checkSymbol()
JavaScript
function
FIGURE 12-66
Not all actions on the main page of the WebStocks application require a
stock symbol. Clearing a retrieved quote, for example, is done regardless of
whether a stock symbol was entered. Lines 29 through 33 in Figure 12-65 define
a function to clear the quote text area of the main form, named quoteList. Once
cleared, the hidden input field is set to indicate the action taken and then the
form field data is submitted to the servlet. Because the setAction() method exists
to accomplish these last two steps, it is called after the text area is cleared.
 
Search WWH ::




Custom Search