Module Portlets


Module portlets are defined in the /web/module/portlets folder.

Portlets are included in a jsp by using the following tag:

<openmrs:portlet url="thismodulesportlet" id="thismodulesportlet" moduleId="thisModulesID" />

where the actual portlet would be a file called thismodulesportlet.jsp in the above folder.

Then in the basicUrlMapping bean in moduleApplicationContext, add a property for the portlet, pointing to the portlet's controller:

<prop key="thismodulesportlet.portlet">thismodulesportletController</prop>

And the controller bean takes a simple bean declaration:

<bean id="thismodulesportletController" class="@MODULE_PACKAGE@.web.controller.thisModulesPortletController"> </bean>

The code inside of a portlet shouldn't have to differ from a standard OpenMRS portlet, meaning that it looks exactly like a jsp (or part of a jsp).

Also, note that in the core basicUrlMapping mapping for openMRS, portlets have a default mapping:

<prop key="**/*.portlet">portletController</prop>.

To override this mapping, be sure that your module's basicUrlMapping has the following property:

<property name="order"><value>50</value></property>,

where the value is anything less than 99 (this prioritizes the module's mappings over the core's default portlet mapping). This may change in the future, but this necessity was created with an upgrade to Spring 2.5 -- if this value ever disappears from openMRS's core basicUrlMapping, it probably doesn't have to be in your module, either.