Create a simple data bean
A data bean is a Java bean that is used in JSP pages to retrieve information from the enterprise bean. A simple data bean extends its corresponding access bean and implements the SmartDataBean interface. By extending an access bean, the data bean provides a simple indirect representation of an entity bean: it encapsulates the properties that can be retrieved from or set within the entity bean. Most code for the data bean is automatically generated by Rational Application Developer. You should store new data beans in the WebSphereCommerceServerExtensionsLogic project.To create a simple data bean, perform the following steps:
- Create the package for data bean code
Creating package creates a place in which your data bean code can be stored.- Create a data bean
Create a data bean that extends the corresponding access bean and implements the appropriate data bean interface.- Add required fields to the data bean
You can modify the required fields in your new data bean. The two required fields are for the following types of information: command context and request properties.- Modifying the populate method
Before using your new data bean, ensure that you populate the bean with its required data in the populate method. This data may include data from the database and input parameters upon instantiation.Related concepts
WebSphere Commerce data beans
Extending the WebSphere Commerce object model with entity beansRelated tasks
Create new entity beans