Java Reference
In-Depth Information
Figure8-4.HTML form accepting data using a complex object
The primary purpose of this example, which is loosely based on an example that ships with
the Jersey implementation, is to illustrate how to create an HTML form that represents your
resource, and allow users to interact with that resource via the form representation. The re-
source in this example is a proxy for a list of products. The product is the basic unit of ex-
change in this example, and comprises two strings (ID and Name) and an integer representing
the quantity, in order to illustrate how to deal with complex, real-world objects. The Product
class (which is a standard POJO) is shown in Example 8-33 .
Example8-33.The Product.java class
package com.soacoobook.rest.order;
public class Product {
private String id;
private String name;
private int qty;
public Product() {
System.out.println("Creating empty product.");
}
Search WWH ::




Custom Search