In this section, we will run the GWT web project. Run the GWT HTML hosted page CatalgForm.html
in a browser with the URL http://localhost:8080/gwt-jboss-ajax/CatalogForm.html
. The GWT widget-generated input form gets displayed, as shown in the following screenshot:
Start to specify a Catalog ID value. As the TextBox
widget supports Ajax, a validation message gets displayed as shown in the following screenshot to indicate whether the Catalog ID value is valid according to the logic that the value is not an empty string and is not already in HashMap
for the catalog.
An Ajax request is sent with each key-up event as the Catalog ID TextBox
widget is registered with the com.google.gwt.event.dom.client.KeyUpHandler
event handler. A value of catalog
for Catalog ID is still valid, as shown in the following screenshot:
Specify a value that is already in HashMap
, such as catalog1. A validation message, Catalog ID is not Valid, gets displayed, as shown in the following screenshot. The input fields get filled and the Submit button gets disabled:
The Catalog ID value catalog2
is also not a valid value, as shown in the following screenshot:
The Catalog ID value catalog3
is a valid value to create a new catalog entry. Specify input field values and click on the Submit button to create a new catalog entry, as shown in the following screenshot:
A new catalog entry gets added to HashMap
. A catalog entry with Catalog ID catalog3
gets created. After the user clicks on Submit, the user does not receive any notification that the data has been stored. To verify that the data has been stored, the user must clear Catalog ID first and re-add Catalog ID. If catalog3
is respecified as Catalog ID, catalog3
is considered as invalid, as shown in the following screenshot: