The Update
Fields button sends an Ajax request with the ajax:updateField
AjaxTags tag. The XML server response gets parsed by the
ResponseXmlParser and the form fields get filled with the response
values as shown in Fig. 6.10.
Fig. 6.10 Updating Form Fields
6.5 Validating a Form with AjaxTags 127
To create a new catalog entry, select a Catalog Id value, Catalog4
for example, that is not already in the database. A validation message gets
displayed, ???Catalog Id is Valid???. Click on the Update Fields button.
As the catalog4 Catalog Id is not in the database, null values get
specified as shown in Fig. 6.11.
Fig. 6.11 Valid Catalog Id
Specify field values for a new catalog entry with Catalog Id
catalog4 Click on the Create Catalog button to create a catalog entry as
shown in Fig. 6.12.
Fig. 6.12 Creating a Catalog Entry
128 6 Ajax without JavaScript ??“ AjaxTags
A new catalog entry gets created in the database. If the input.jsp is rerun
and the catalog4 value is re-selected a validation message gets
displayed, ???Catalog Id is not Valid???. Update the form fields with the
Update Fields button as shown in Fig. 6.13. The form gets filled with the
catalog entry previously created.
Fig. 6.13 Reselecting a Catalog Id
6.6 Summary
The AjaxTags tag library is an Ajax framework to include the Ajax web
technique in a JSP application. With AjaxTags tag library JavaScript is not
required to send the Ajax request and process the Ajax response.
Pages:
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125