In this section,
we shall run the AjaxCatalog.jsp
file to demonstrate AJAX. Run the AjaxCatalog.jsp
with the URL http://localhost:7001/ajaxform/AjaxCatalog.jsp
. Start to specify a catalog ID. The validation message indicates if the Catalog Id is valid. We created only two catalog entries in the Catalog
database; catalog1
and catalog2
. The business logic used to find the validity of a catalog ID is that if a catalog ID other than the two catalog IDs is specified, then the catalog ID is valid and a Catalog Id is Valid message gets displayed. The business logic to ascertain the validity of a catalog ID may be modified in the FormServlet
servlet. An AJAX request is sent with each modification.
Specify a
Catalog Id that already exists, such as catalog1
. A message indicates the catalog ID is not valid. The form fields get filled with the catalog entry values, which is an example of autocompletion (see the following screenshot for reference).
Similarly, for catalog2...