|
Page 2 of 3
.
.
Optionally, specify one or more cascading style sheet (CSS) files to to be referenced by the new JSP file. Typically, CSS files are located in the /theme folder under the Web Content folder.

15. Click Next to select specific method stubs and add deployment information to the Web project's web.xml file.
Select any appropriate method stubs to be created in the servlet that is deployed for this JSP file.
If you select the Add to web.xml check box, the JSP file, along with its display name, and any URL mappings and initialization parameters associated with the JSP file will be automatically included in the Web project deployment descriptor file. Note that the File Name value provided in the previous page of the wizard is automatically mapped to the Servlet Name value on this page, as well the URL Pattern mappings. These mappings are not updated if you change the original value in the File Name field.

16. Click Finish to create the file in the project that you have selected. The file will open in an HTML editor. The default is Page Designer, in the Design page.
Creating Web pages from Java beans
The Create JavaBeans Web Pages wizard supports the following activity models:
- Set bean properties: Create an input form that collects input from users and stores the resulting data within the properties of a Java bean.
- Retrieve bean properties: Create a result form that displays a bean's current property values.
- Execute a bean's method(s): Run any number of methods from a bean by submitting an input form
- Execute a bean's method(s) with parameters: Create an input form that collects data from users, and use this data as input to a bean's methods.
- Display a method's result: Create a result page that displays the return value of a method.
- Combination: Create a set of pages that include any combination of the above models.
Follow these steps to create Web pages from Java beans:
1. To launch the Java Bean Web Pages wizard, select File > New > Other. Then select the Web option, Java bean Web Pages, and then the Next button.
2. On the initial wizard page, use Browse to specify the location into which the generated Web pages will be placed, as well as where all servlets will be mapped. The Java package name specifies where all Java source code will be placed. A default package is assumed if you do not designate a package name.
3. The View Bean model is the only model type currently available from the drop-down list. This model uses view helpers, which are Java-wrapper classes that manage all database interaction.
4. You also have the option to create and generate an Input form, a JSP Results page, a Controller Servlet, or a View Bean. In the course of completing the wizard, you will have an opportunity to customize the content and layout of these generated objects. The File Description area provides information about each object that you select.

5. Click Next.
6. Use Browse to locate the bean that will act as the model for your generated Web pages, or type the class name in the Bean field. For purposes of the wizard, any Java class that has a public constructor is considered to be a bean.
Note: If you use the Browse button, when you click OK in the Choose Java bean dialog, the bean is automatically introspected.
There are three potential locations for the bean:
- In the Java Source folder of your Web project.
- In a .jar file containing included in the Java Build path of your Web project.
- In the Java Build path of your Web project.
7. If you typed the bean name, click the Introspect button to initiate bean introspection. The wizard supports complex data types, including user-defined classes, arrays of Objects and Primitives, Collections, Iterators, Enumerations, Maps, and ResultSets. The introspection is performed on the entire definition hierarchy; however, you will be able to select the level of granularity used in the generated pages from a hierarchy tree of the complex type.
8. Using the check boxes or the All or None button, select the bean methods to be executed by the servlet. The wizard should make available the public void methods() { } that have primitive type parameters from your Java bean. The wizard also provides additional public methods inherited from any of the superclasses in the bean's hierarchy.

9. Click Next.
10. In the View Bean Data Page, use the Add button to locate and add a style sheet from your workspace. To use an error page, click the check box and use the Browse button to locate the error page.
Style Sheets allow you to define colors, fonts and many other attributes of your HTML tagging. The error page enables you to specify a URL that is forwarded to a user's browser if an error is encountered while executing one of the generated resources.
11. Select the Request or Session radio button to identify the model type. Storing the results in a session will allow the data to be used in multiple pages for the duration of the session. Storing the results in a request will allow access to the data only for the duration of the request; the result set is destroyed after the request is processed, freeing up memory on the server. The default is Request.
12. Optionally, you can include or remove processing layers from the model used to generate Web pages.
A Front Controller is a servlet that serves as the single entry point for all requests to a Web application region. A controller provides a single point to perform all authentication, logging, debugging, and to all subsequent views, including the input, master results, and details results views. You can choose to automatically create a new controller, reuse an existing controller, or not use a controller at all [default]. If you choose not to use a controller, that functional layer of processing is not performed.
View Beans are wrappers that allow you to have more control over how data is displayed when it is rendered in generated Web pages. If you deselect this option, the wizard accesses data using the underlying beans directly.

13. Click Next
14. Design the input form by specifying the page properties and the bean properties and method parameters (fields) that the generated Web page will expose to user input. This page will show you the public properties of the bean, as well as any parameters that must be specified for the methods selected on the previous page. Expand the tree to view more of the complex type hierarchy if you want add greater granularity to the form. The scrolling panel on the right side of this page approximates the look and layout of the resulting page.
You can also use the All or None button to select or deselect the entire list (although parameters lower in the hierarchy are not selected). Click the up and down arrow buttons to reorder the columns in the input page.
15. Select and update, as needed, values in the properties table.

16. Click Next.
Design the result form by specifying the page properties and the bean properties (fields) that the generated Web page will display as output to the user. Expand the tree to view more of the complex type hierarchy if you want add greater granularity to the form. The wizard should only make available the public void getMethods() { } from your Java bean.
17. You can also use the All or None button to select or deselect the entire list (although parameters lower in the hierarchy are not selected). Click the up and down arrow buttons to reorder the columns in the input page.
18. Select and update any of the following properties:
Page - Page properties include Page Title, Background Color, Title Color, and Field Color.
Field - Field properties include ID, Label, Initial Value, Field Type, Size, Max Length, and Layout Style. Note that the Size property addresses the physical dimensions of the field, and the Max Length is a specification of the maximum number of characters or string length allowed.

19. Click Next
20. Provide a common Prefix for the pages that are generated from the specified beans. Note that the list of generated pages and resources will reflect any changes to the prefix as you type in the Prefix field.

21. Click Finish to generate the Web pages.
|