Properties can be retrieved from a work area by using the get method. This method is intentionally lightweight; there are no declared exceptions to handle. If there is no active work area, or if there is no such property set in the current work area, the get method returns null.
The following example shows the retrieval of the site-identifier and priority properties by the SimpleSampleBean. Notice that one property was set into an outer work area by the client, and the other property was set into the nested work area by the server-side bean; the nesting is transparent to the retrieval of the properties.
public class SimpleSampleBeanImpl implements SessionBean { public String [] test() { ... // Begin a nested work area. userWorkArea.begin("SimpleSampleBean"); try { userWorkArea.set("company", SimpleSampleCompany.London_Development); } catch (NotOriginator e) { } SimpleSampleCompany company = (SimpleSampleCompany) userWorkArea.get("company"); SimpleSamplePriority priority = (SimpleSamplePriority) userWorkArea.get("priority"); ... } }
For additional information about work areas, see the package, com.ibm.websphere.workarea, in the API documentation. The generated API documentation is available in the information center table of contents from the path Reference > Developer > API documentation > Application programming interfaces.