C H A P T E R 5 |
Tutorial--Section 1.2 Create Login Page |
This chapter describes how to add your first Sun ONE Application Framework page to the application infrastructure you created.
Create the first page of the application.
1. Select the main module folder from the Sun ONE Web Apps Explorer.
2. Click the Add Page button on the Sun ONE Application Framework toolbar
a. Select the Sun ONE Studio menu option File -> New.
b. Expand Sun ONE Application Framework (JATO) node
a. Right-click the main module folder.
3. Expand the Sun ONE Application Framework folder.
The View Location panel displays.
6. Enter LoginPage in the Name field (to replace <default>).
7. In the View beans tab, select Basic ViewBean.
The Associate JSP panel displays.
9. Check the Use formatting to beautify fields on JSP option.
Note - There are additional steps in the Page wizard. However, those steps involve model field binding which is not required for the LoginPage. In a later task, you will use these additional steps. |
The generated source code displays in the Sun ONE Studio editor.
12. Expand the LoginPage node.
13. Select the Visual Components node under the LoginPage node.
14. In the Sun ONE Application Framework Component Palette, click the Static Text Field option.
A static text visual component is added to the Visual Components node.
The default name is staticText1.
15. Right-click the staticText1 field name.
17. Rename the field to message.
18. Add two more display fields.
The following table contains a list of the two visual component types with each of their names and the initial value for the Button type.
The three display fields display under the Visual Components node of the LoginPage.
Adding display fields to the Page also adds the appropriate JSP tags for the display fields to the JSPs that are using this Page.
19. Set the button's Initial Value property by selecting login.
20. Click in the Initial Value property value entry area.
The button's value is the string that displays on the button in the browser.
22. Open the LoginPage's JSP to see the tags for the three display fields.
a. Expand the JSP Pages node under the LoginPage node.
b. Double-click the LoginPage JSP to open it in the Sun ONE Studio editor.
23. Format your JSP layout however you want.
You can edit it directly in the Sun ONE Studio editor, or you can use your favorite WYSWIG HTML editor.
Here is an example of some minimal JSP changes (only pertinent code is shown here). Some HTML source code appears in bold type below for emphasis.
24. Right-click the login button.
25. Select Events -> handleRequest
The LoginPage.java file opens and the handleLoginRequest event stub is inserted.
26. Implement the login button handle request code.
Replace the following default code:
getParentViewBean().forwardTo(getRequestContext());
with the code shown in bold below:
Copyright © 2003, Sun Microsystems, Inc. All rights reserved.