Browse Prior Art Database

Moving data from an HTTP request object to a data object with name retention in Java. Disclosure Number: IPCOM000015075D
Original Publication Date: 2002-Feb-10
Included in the Prior Art Database: 2003-Jun-20

Publishing Venue



This disclosure describes an algorithm for moving data from an HTTP Request object to a data object with name retention in Java. Based on a simple naming scheme, it is possible to automate the mapping of HTTP Request data to attributes in a Java data object, thus removing the need for programmer-level mapping of each individual value. This generic algorithm can support multiple data objects as well as data objects with various numbers of attributes, provided the naming scheme is adhered to. In a typical web application, a user enters data into a web page consisting of an input form. When data entry is complete, the user then submits the form to a server over HTTP. The information provided to the server by a user's browser is made available through the Request object. It is then the server's responsibility to retrieve the applicable data from the Request object. Most of the time, data sent by a user is gathered from the Request object and retained in a data object for subsequent processing and/or persistent storage. To transfer data from the Request object to a data object, server-side applications must know the name of the parameter to retrieve from the Request object and the specific data object field it corresponds to. For each piece of information sent by the user that needs to be stored in the data object, explicit mapping of the Request parameter to a data object field is needed. For web applications that utilize many data objects in such a manner, or for data objects that contain many fields, this requirement of explicitly mapping Request parameters to data object fields is time-consuming and cumbersome. Instead of explicit data mapping, a naming scheme is adopted to identify the mapping of an input form field to a data object attribute. This naming scheme is a prerequisite to the data movement algorithm. A Java class representing a data object must make its data accessible via accessor methods (getter/setter methods). Accessor methods prefix the attribute name with the words "get" and "set" for getter methods and setter methods respectively. Input elements of an HTML form (i.e. text and selection boxes) must be named precisely as the data object attribute it corresponds to. In other words, an attribute must have the same name in the input form definition as in the data object definition (see Figure 1.1). 1