Next, run the JSF page. Right-click on input.jsp and select Run
as shown in Fig. 7.13.
7.7 Processing the Ajax Response 155
Fig. 7.13 Running Ajax4jsf Application
The catalog entry form gets displayed as shown in Fig. 7.14.
Fig. 7.14 Catalog Entry Form
156 7 Ajax with JSF-Ajax4jsf
Start to specify a value for the Catalog ID. A validation message gets
displayed as shown in Fig. 7.15.
Fig. 7.15 Validating Catalog ID
An Ajax request gets sent with each modification to the Catalog ID
field and a validation message gets displayed. Specify a Catalog ID value
that is already in the database, for example catalog2. A validation
message gets displayed:???Catalog ID is not valid???. The form field values
get autocompleted for the specified Catalog Id and the Submit button gets
disabled as shown in Fig. 7.16.
7.7 Processing the Ajax Response 157
Fig. 7.16 Non Valid Catalog ID
To create a catalog entry, specify a Catalog ID value that is valid.
Specify the form field values and click on Submit button as shown in Fig.
7.17. A catalog entry gets created.
158 7 Ajax with JSF-Ajax4jsf
Fig. 7.17 Creating a Catalog Entry
7.8 Summary
The Ajax4jsf component library adds Ajax functionality to JSF
applications. Thus the set of UI components provided by JSF may be
availed of in combination with Ajax. In this chapter we used the Ajax4jsf
framework to send an Ajax request from a input form to validate catalog id
for a catalog entry.
Pages:
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146