Application Objects and Server Behaviors

 < Day Day Up > 



What makes Dreamweaver so attractive as a Web development tool is that it ships with most of the functionality you'll ever need to display, add, delete, and modify data sources. It contains complex server-side logic (server behaviors) that helps control page access, authenticate users, show content when specific conditions are met or not — in short, you need not ever write a line of code to build complex page functionality. Dreamweaver also ships with Application Objects — HTML elements that incorporate server behaviors — to save you time and effort when developing page functions.

Access Application Objects via the Insert ® Application Objects menu, as shown in Figure 46-10.

click to expand
Figure 46-10: Insert application objects that build HTML elements with server behaviors already incorporated.

Add server behavior logic to an existing HTML element or page via the Server Behavior panel's menu, as shown in Figure 46-11.


Figure 46-11: The Server Behavior menu options

Here is just some of the functionality that can be incorporated into your page through the use of the Server Behaviors panel or through the Insert ® Application Objects bar or menu options:

  • Recordset — Defines a recordset from an existing database. The recordset you define is stored in the Bindings panel.

    On the CD-ROM 

    See exercise add_recordset.pdf in the chapter46_exercise folder on the CD for steps to add a recordset to a page.

  • Repeat Region — Repeats a selected region (as in table row) to display multiple records on a single page. You select an entire table or individual cells or rows that contain dynamic content, and specify the number of records to display on each page view.

    On the CD-ROM 

    See exercise repeat_region.pdf in the chapter46_exercise folder on the CD for steps to repeat a table row for displaying database records in your page.

  • Dynamic Table — Used to create and insert a dynamic table into a page to show database table records. Useful for quickly building a table that contains the exact number of columns contained in the database table. Options include limiting the number of records displayed or displaying all records. Limited table formatting is included but you may change the format of the table through the Property inspector or by applying CSS to the table elements. When you choose to limit the number of records displayed, you must also add recordset navigation behavior.

  • Dynamic Text — Used to insert a dynamic text object from a datasource into a page.

    On the CD-ROM 

    See exercise say_hello_user.pdf in the chapter46_exercise folder on the CD for steps to use dynamic text and a data source to personalize a page.

  • Recordset Navigation — Used to insert a record navigation bar for navigating through database records. Creates links that enable a user to view previous and next records from a database record.

    On the CD-ROM 

    See exercise next_user.pdf in the chapter46_exercise folder on the CD for steps to add navigational elements that allow movement through database records.

  • Recordset Navigation Status — Adds a record counter to help users keep track of how many records where returned, and where they are in the returned result.

    On the CD-ROM 

    See exercise which_record.pdf in the chapter46_exercise folder on the CD for steps to add element to identify database record(s).

  • Master Detail Page Set — A combination of behaviors that selects a number of records to display in a page and adds functionality to enable one field to link to a detail page that displays a specified set of data for that record. Dreamweaver inserts records, a recordset navigation bar, and a recordset navigation status bar into the current page and adds a table into the destination page to display specified fields for the selected record.

    On the CD-ROM 

    See exercise user_details.pdf in the chapte 46_exercise folder on the CD for steps to set up the selection of a specific user to display complete details for the user's record.

  • Insert Record — Builds a form based on the fields available in the recordset that allows modification of the database by inserting a new record.

    On the CD-ROM 

    See exercise add_user.pdf in the chapter46_exercise folder on the CD for steps to add a new user to the database records.

  • Record Update Form — Adds a form for the selected recordset and displays a single record from the database. A user can modify the data displayed and change the database record. Adds navigation objects for selecting specific records.

    On the CD-ROM 

    See exercise update_user.pdf in the chapter46_exercise folder on the CD for steps to update an existing user's database record.

  • Delete Record — Removes an existing record from a database.

    On the CD-ROM 

    See exercise remove_user.pdf in the chapter46_exercise folder on the CD for steps to remove an existing user from the database.

  • Show/Hide Regions — Displays or hides an HTML element and its content when specific conditions are met.

    On the CD-ROM 

    See exercise show_hide.pdf in the chapter46_exercise folder on the CD for steps to display content based on specific conditions.

  • User Authentication — A set of behaviors that compares user information against a data source to allow or restrict access to pages in the site.

    On the CD-ROM 

    See exercise login_user.pdf, create_variables.pdf, restrict_access.pdf, and validate_user.pdf in the chapter46_exercise folder on the CD for steps to build a login form, create form parameters, restrict access to site pages based on the authorization level of the user, and to create a session variable that maintains the user's login state throughout the site pages.

Adding server behaviors to a page

Depending upon your level of expertise with the server-side technology of your choice, you have several methods available to incorporate server behaviors into your pages:

  • If you are new to dynamic pages, use the Insert ® Application Objects menu to insert the appropriate HTML element and server behavior functions into your page.

  • If you're an experienced developer, build your own HTML elements and use the Server Behaviors panel to apply specific functionality.

Removing server behaviors from a page

The best method of removing server behaviors from a page is to select the behavior in the Server Behaviors panel and use the Minus (-) button to remove it. If you simply select the element on your page that has the behavior attached, you may be prompted by Dreamweaver to undo the step and use the panel instead. Deleting the page element doesn't remove all the associated server behavior code.



 < Day Day Up > 



Macromedia Studio MX Bible
Macromedia Studio MX Bible
ISBN: 0764525239
EAN: 2147483647
Year: 2003
Pages: 491

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net