This sample demonstrates a number of techniques that can be helpful when building a model that uses multiple child models using the Model Container builder.
The attached package includes a master model/portlet (samples/container_events/Main) which uses several other models to build its core functionality. The home page of the main model is a page that includes two views, one which has a column with a link to a details view, and another whose column link loads an update model.
The main model uses Model Container to hold the child models, and the child models communicate with their parent using events.
Some of the techniques shown in this sample include:
Notes on running the sample and prerequisites
- "static" Model Container usage, where the contained model is specified at design time and never changes
- "API-driven" Model Container usage: a "stub" model is specified at design time, while the correct model is "swapped in" using the methods of the Model Container's runtime LJO
- parent/child communication using events, including the use of a common "events" model imported into all participants
- use of an HTTP redirect to a view page after taking an action - this is especially useful to avoid browser back-button by implementing the "POST-redirect-GET" pattern
Import the attached pkg file into your project using the Import WebSphere Portlet Factory Archive command.