When your input form is submitted, the page will automatically
add the new record to the database. In this lesson, you will program
the Post New Listing submit button to return
to the all_records.jsp page so that you can immediately
view the new record in the database.
To program the submit button:
- In the new_record.jsp file, right-click the Post
New Listing button you created in the form on the Web
page and select Properties. The
hx:commandExButton tab is displayed in the Properties view.
- Click Add Rule. The Add
Navigation Rule window opens.
- From the Page drop down, select all_records.jsp then
click OK.
- Save the page.
Prevent duplicate keys
Important: Since
the ID column is a primary key in the ADS table, you cannot add records
with an ID value that already exists in the table. In Module 2, you
will see how to use automatic key generation to automatically create
a new unused key for each new record.
Until then, you must enter
an unused ID number in this page to add a new record. The records
that come with the database use ID numbers from 1 to 24, so you can
enter any number above 24 as a primary key. Be sure not to duplicate
keys if you enter more than one record.