Committing and persisting the modifications
To persist the modifications that you applied to the controller, you commit the controller.
We can commit only the ContentModelController and the PortletModelController as only these two implement the Committable interface. We cannot commit a LayoutModelController. Committing the LayoutModelController is included when we commit the ContentModelController from which you obtained the LayoutModelController. Committing the ContentModelController can include committing more than one LayoutModelController.
The following example shows how you commit a controller and then dispose it:
- After we have successfully committed a controller, we must not use it any more. In particular, do not invoke the commit() method again at a later stage.
- After we have used a controller, you always need to dispose it.
- If we do not want to persist the changes made using the controller, dispose it without invoking commit() on it.
// commit the controller try { controller.commit(); } finally { controller.dispose(); }
Parent Work with controllers