The parser attribute is set to ResponseXmlParser.
In the FormUpdateServlet, the catalogId parameter value is
retrieved and a result set obtained from the database table Catalog for
the catalogId value. The XML response from the server is constructed
with the AjaxXmlBuilder class. The format of the XML response is as
follows.
Record 1
1
Record 2
2
Record 3
3
Create an AjaxXmlBuilder object to construct the response and set
the response content type to text/xml.
AjaxXmlBuilder builder = new AjaxXmlBuilder();
response.setContentType(???text/xml???);
Obtain the catalog entry field values from the ResultSet object.
String journal=rs.getString(???Journal???);
String publisher=rs.getString(???Publisher???);
String edition=rs.getString(???Edition???);
String title=rs.getString(???Title???);
String author=rs.getString(???Author???);
120 6 Ajax without JavaScript ??“ AjaxTags
Add the field values to the AjaxXmlBuilder object.
builder.addItem(???journal???,journal);
builder.addItem(???publisher???,publisher);
builder.addItem(???edition???,edition);
builder.addItem(???title???,title);
builder.addItem(???author???,author);
Output the AjaxXmlBuilder XML response using the
toString() method.
Pages:
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120