Exforsys

WebSphere Tutorials

  1. WebSphere V5.0 : Building Expressions
  2. WebSphere V5.0 : Creating SQL statements
  3. WebSphere V5.0 : Applying DDL scripts to a remote database
  4. WebSphere V5.0 : Deploying to the database
  5. WebSphere V5.0 : Defining a table
  6. WebSphere V5.0 : Defining a database
  7. Working with Data in WebSphere
  8. WebSphere V5.0 : Debugging - JSP debugging
  9. WebSphere V5.0 : Debugging - Scrapbook Page
  10. WebSphere V5.0 : Debugging - View variables
  11. WebSphere V5.0 : Debugging - Step-through code
  12. WebSphere V5.0 : Debugging - Set breakpoints
  13. WebSphere V5.0 : Running Applications - Export J2EE applications
  14. WebSphere V5.0 : Running Applications - Run/operate server
  15. WebSphere V5.0 : Running Applications - Understand Session Manager
  16. WebSphere V5.0 : Running Applications - Configure data sources
  17. WebSphere V5.0 : Running Applications - Create server instance and server configuration
  18. WebSphere V5.0 : Web Development - Use Web Page Wizards
  19. WebSphere V5.0 : Web Development - Work with Web Application Deployment Descriptor
  20. WebSphere V5.0 : Web Development - Use content assist
  21. WebSphere V5.0 : Web Development - Use Page Designer to add and modify HTML and JSP content
  22. WebSphere V5.0 : Web Development - Understand classpath and module dependencies
  23. WebSphere V5.0 : Web Development - Create resources in appropriate J2EE locations
  24. WebSphere V5.0 : Web Development - Create a web project
  25. WebSphere V5.0 : Java Development - Use property dialogues
  26. WebSphere V5.0 : Java Development - Use hierarchy view
  27. WebSphere V5.0 : Java Development - Use task view
  28. WebSphere V5.0 : Java Development - Use search function
  29. WebSphere V5.0 : Java Development - Use content assist function and declarations
  30. WebSphere V5.0 : Java Development - Use refactoring features
  31. WebSphere V5.0 : Java Development - Use Outline View and Browsing View
  32. WebSphere V5.0 : Java Development - Create Java project, packages, classes, methods
  33. WebSphere V5.0 : Workbench Basics - Use the Help feature to aid in development activities
  34. WebSphere V5.0 : Workbench Basics - Import to and export from the workbench
  35. WebSphere V5.0 : Workbench Basics - Work with Perspectives
  36. WebSphere V5.0 : Workbench Basics - Set workbench preferences
  37. WebSphere V5.0 : Workbench Basics - Create J2EE projects

Ads


Home arrow Reviews arrow WebSphere Tutorials

WebSphere V5.0 : Web Development - Use Web Page Wizards Page - 2

Page 2 of 3
Author : Exforsys Inc.     Published on: 16th May 2006    |   Last Updated on: 21st May 2006

WebSphere V5.0 : Web Development - Use Web Page Wizards

Ads


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.

Document Type

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.

URL Pattern

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.

Options

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.

Select methods

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.

Select options

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.

Properties

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.

Properties

Ads

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.

Prefix

21. Click Finish to generate the Web pages.



 
This tutorial is part of a WebSphere Tutorials tutorial series. Read it from the beginning and learn yourself.

WebSphere Tutorials

  1. WebSphere V5.0 : Building Expressions
  2. WebSphere V5.0 : Creating SQL statements
  3. WebSphere V5.0 : Applying DDL scripts to a remote database
  4. WebSphere V5.0 : Deploying to the database
  5. WebSphere V5.0 : Defining a table
  6. WebSphere V5.0 : Defining a database
  7. Working with Data in WebSphere
  8. WebSphere V5.0 : Debugging - JSP debugging
  9. WebSphere V5.0 : Debugging - Scrapbook Page
  10. WebSphere V5.0 : Debugging - View variables
  11. WebSphere V5.0 : Debugging - Step-through code
  12. WebSphere V5.0 : Debugging - Set breakpoints
  13. WebSphere V5.0 : Running Applications - Export J2EE applications
  14. WebSphere V5.0 : Running Applications - Run/operate server
  15. WebSphere V5.0 : Running Applications - Understand Session Manager
  16. WebSphere V5.0 : Running Applications - Configure data sources
  17. WebSphere V5.0 : Running Applications - Create server instance and server configuration
  18. WebSphere V5.0 : Web Development - Use Web Page Wizards
  19. WebSphere V5.0 : Web Development - Work with Web Application Deployment Descriptor
  20. WebSphere V5.0 : Web Development - Use content assist
  21. WebSphere V5.0 : Web Development - Use Page Designer to add and modify HTML and JSP content
  22. WebSphere V5.0 : Web Development - Understand classpath and module dependencies
  23. WebSphere V5.0 : Web Development - Create resources in appropriate J2EE locations
  24. WebSphere V5.0 : Web Development - Create a web project
  25. WebSphere V5.0 : Java Development - Use property dialogues
  26. WebSphere V5.0 : Java Development - Use hierarchy view
  27. WebSphere V5.0 : Java Development - Use task view
  28. WebSphere V5.0 : Java Development - Use search function
  29. WebSphere V5.0 : Java Development - Use content assist function and declarations
  30. WebSphere V5.0 : Java Development - Use refactoring features
  31. WebSphere V5.0 : Java Development - Use Outline View and Browsing View
  32. WebSphere V5.0 : Java Development - Create Java project, packages, classes, methods
  33. WebSphere V5.0 : Workbench Basics - Use the Help feature to aid in development activities
  34. WebSphere V5.0 : Workbench Basics - Import to and export from the workbench
  35. WebSphere V5.0 : Workbench Basics - Work with Perspectives
  36. WebSphere V5.0 : Workbench Basics - Set workbench preferences
  37. WebSphere V5.0 : Workbench Basics - Create J2EE projects
 

Comments