A model is a collection of builder calls that you can make self-contained.
You can use a Model Container builder to make a model self-contained and allow it to be inserted into a web page. Using multiple models with model containers provides two main advantages:
Using model containers makes shared development easier. Multiple developers can collaborate on page content and creation. Each developer can work independently and contribute a model that provides specific content to the same page.For web users
Model Container builders provide a consistent page context. A web page incorporating contained models enables users to remain in the context of that page, even as they drill down into a model in search of additional content. This keeps users oriented, and it also facilitates users' access to content in other models on the page.
Using container builders, multiple developers can develop a portion of a page and add their separate models to the page. Each model is assigned to a container, which is a placeholder for the model to be displayed. Models can also contain containers, allowing for unlimited nesting of models within containers. From the point of view of someone accessing the page, the page is displayed as a seamless whole, offering a mosaic of content. However, as a user clicks down into each model, to view details, the overall context of the page remains constant, with only the specific model segment of the page changing.
Guidelines for cooperative portlet models
If you add a model that contains a Cooperative Portlet Source builder to a model container, there are some guidelines to follow.
- The name of the model that contains the Cooperative Portlet Source builder must be able to be resolved during regeneration. For example, the name cannot be an indirect reference.
- Use only Java Portlet Standard 2.0 (JSR 286) events in the model. Only those type of events propagate to the model container. The model container cannot handle WSDL-based events.
Adding a model that contains a Cooperative Portlet Target builder to a model container is not supported.
If you are using a version of IBM® WebSphere® Portlet Factory Designer prior to 6.1.2, to have the addition of the model with the Cooperative Portlet Source builder recognized, open any existing models in WebSphere Portlet Factory Designer, regenerate them, and save them.
Tips for using models within containers
- Inputs within model containers are used the same way as inputs within models.
- Performance is related to the number of linked models in the container. More linked models in your model container lead to slower performance, but also leads to more manageable code, because it is in smaller chunks.
- Do not use frames. Frames are not supported within model containers.
- Remove <HTML> and <body> tags from models you want to insert in a container. Before you insert a model in a container, make sure the <HTML> and <body> tags are removed from the model, especially if the <body> tags are assigned to a style. This technique prevents the style in the model from overtaking the styles of other models on the page.
- If you are using input mapping, a form in the model must be assigned to a name. If the form is not named, the inputs are assigned to the first form listed the builder finds.
- If a model within a container uses a form, any forms in the outer model should not wrap the Model Container builder. If the outer model has a form that wraps the Model Container builder call and the model in the container also has a form, the outer form is always submitted even if a user attempts to submit the inner form. The outer model can safely use forms if both form tags come before or after the model container or the portal container. The form tags should never wrap the container if the contained model has its own form tags.
- Apply a limited amount of styles to the user interface to allow the models to adopt the look and feel of the page into which they are inserted.
- Keep the base HTML to layout only.
- Use the Imported Page builder to construct HTML pages rather than the Page builder. This setup allows you to control the user interface. Construct an absolute URL to the source HTML to allow the HTML to be moved off of the server if necessary. The absolute URL could be controlled through a configuration file entry or a profile entry.
Parent topic: Placing a model within a container