alt
Advertisement

Online Training
Career Series
Exforsys
Exforsys arrow Tutorials arrow WebSphere arrow WebSphere V5.0 : Web Development - Use Web Page Wizards
Site Search
Sponsored Links



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

.

.

Creating Web pages from SQL statements

The Database Web Pages wizard uses servlet technology to generate Web pages from SQL statements. After providing some general storage and Web page creation parameters, you will select a database model or establish a connection to a database to import a model. Next, you will build a new statement or use an existing statement as a basis for generating Web pages. You can create an input page that collects information to filter the SQL statement, and design the result and detail pages that will format and display the resulting filtered statements to users.



Follow these steps to create Web pages from an SQL statement:

1. To launch the Database Web Pages wizard, select File > New > Other. Then select the Web option, Database Web Pages, and then the Next button.

2. Specify the location into which the generated JSP and HTML files will be placed, as well as where all servlets will be mapped. You should select the Web Content folder, or one of the folders under Web Content. The Java package field specifies where all Java source code will be placed. A default package is assumed if you do not designate a package name.

3. Select one of the SQL statement types from the SQL Statement Type list box.

4. Select one of the generation models from the Models list box. The Description area provides information about the generation model that you have selected. Based on the statement type and generation model combination, the Files list box lists the pages that will be generated. If you click on a file, a short description is displayed in the File Description box.

5. You also have the option to create and generate an Input Form, the Select Master View or just a Select Details View, or Front Controller. In the course of completing the wizard, you will have an opportunity to customize the statement content and layout of these forms. The File Description area provides information about each form that you select.

Database Web Pages

6. Click Next.

7. Choose how to create the SQL statement. If you already have an SQL statement written, from the Select an existing statement saved in your workspace page, you can browse to locate a statement that exists in a workbench project. Click Next.

Choose SQL statement

8. Choose whether to use a data source connection or a driver manager connection in the Runtime Connection Page. A data source connection name should be the JNDI name defined in the server configuration.

A data source is the preferred database connection type for a Web application. A data source is defined in a Web server. Usually, it is a pooled connection, so that the server makes a pool of connections to the database on startup. Each time a JSP file requires a database connection, the server provides one of its pooled connections, which minimizes the connection overhead for the JSP file. When the JSP is done executing, it releases the database connection back to the pool.

For a driver manager connection, the JSP file requires a new connection to the database on each execution. Supply the driver name and associated URL.

Supply the User ID and Password, along with a verification of the password, necessary to access the target database. If this is a new connection, the User ID and Password specified in the Database Connection page are reflected here. If you used an existing database model or an existing SQL statement, these are the values originally used to load the existing database model. The User ID and Password will be added to the web.xml file as an initialization parameter of the servlets associated with the Master View and Details View result pages.

Runtime Connection Page

9. Click Next.

10. In the Controller Page, select the check box and use the Browse button to associate a style sheet or error page from the current project with the generated Web pages.

Style Sheets allow you to define colors, fonts and many other attributes of your HTML tagging. The error page enables you 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.

Controller

13. Click Next.

14. Select and update, as needed, values in the Host variables list and properties table to determine the content, layout, and design attributes of the input form. The scrolling panel on the right side of this page approximates the look and layout of the resulting input page. You can also use the All or None button to select or deselect the entire list. Click the up and down arrow buttons to reorder the columns in the input page.

At least one column must be specified as a Key Value if you chose to generate a Details form.

Properties

15. Click Next.

16. Select and update, as needed, values in the Result set columns list and properties table to determine the content, layout, and design attributes of the Master View Web page. 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. Click the up and down arrow buttons to reorder the columns in the result table.

At least one column must be specified as a Key Value.

Master View Properties

17. Click Next.

18. Select and update, as needed, values in the Host variables list and properties table to determine the content, layout, and design attributes of the Details View Web page. 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. Click the up and down arrow buttons to reorder the columns in the details table.

Details View Properties

 


19. Click Next.

20. Provide a common Prefix for the pages that are generated from the statement. 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.

_____________
Author: Mikalai Zaikin. Please Click Here to visit Authors site for any updates and changes to the study notes.


Trackback(0)
Comments (0)add comment

Write comment

busy

 
< Prev   Next >
Sponsored Links
© 2008 Exforsys.com
Joomla! is Free Software released under the GNU/GPL License.
Page copy protected against web site content infringement by Copyscape