Portlet Factory, Version 6.1.2


 

Model Container builder

Use the Model Container builder to reserve a place on a page at which a model is to be placed. This feature allows more than one model to be placed on a page.

 

Quick tips

  • Only one model can be activated in a container at one time.

  • You can have any number of Model Container builders in a model, typically one for each Web service on a page. You can also have an unlimited container hierarchy. For example, one container could contain two containers. The first of these containers could contain an additional eight containers and the second could contain two.

  • 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 container calls the "main" action of the contained model for initialization.

  • 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 as long as both form tags come before or after the model container. The form tags should never wrap the container if the contained model has its own form tags.

 

About the Model Container builder

The Model Container builder allows you to dynamically link a model to a model container at run time. This is done in the WebApp in a ModelContainer object. The Model Container creates a placeholder in the WebApp for a model to be dynamically linked at run time. When the outer model is run and the inner model is activated (dynamically linked), the Web service is placed on the page.

The Model Container builder uses a linked model and an inserted page to display the main page with its associated model, and it is also responsible for invoking the model initialization action at load time.

Each Model Container creates a linked Java object with the name given to the model container, and it implements the interface below. For example, to change the model in a container named C1, call C1.setModelName(newModel), and this model is loaded the next time the container renders.

Note: For more information about the IBM® WebSphere Portlet Factory API, refer to the API documentation, which is accessible from the WebSphere Portlet Factory information center.

public void setModelName(String modelName);

Sets the name of the model held by this container. The parameter modelName is the model contained.

public String getModelName();

Gets the name of the model held by this container. This method returns the currently contained model.

public void setProfileName(String profileName);

Sets the name of the current model profile. The parameter profileName is the profile currently in use.

public String getProfileName();

Gets the name of the current model profile. This method returns the profile in use.

public void callInitializationAction(WebAppAccess webAppAccess, Object initData, String force);

Calls the model initialization action for the current model. The parameter initData is the data to pass to the action. If the parameter force is true, the method calls the action even if it has already been previously called.

Parent topic: Builder help


Library | Support |