Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

    1. In the platform there is an openmrs-servlet.xml file that contains the mappings between each request path URL and the controller that serves processes it, you need to move the URL mapping entry along with its associated controller bean to the module, the bean with id urlMapping has a property named mappings which also has a list of props elements, copy the respective prop element for the page you are moving. For example, if you are moving the concept form, you would need to move the entry shown below to the module

      Code Block
      languagexml
      <prop key="dictionary/concept.form">conceptForm</prop>
    2. As seen from above, the prop entry references the conceptFrom bean shown below, it means we also need to move it too to the module. Note that the formView property has been prefixed with module/legacyui because conceptForm.jsp has been moved to the legacy UI module. Note that we don't change the successView property because pretty all their values are not paths but rather request URLs that are already mapped to some other controllers.

      Code Block
      languagexml
      <bean id="conceptForm" class="org.openmrs.web.controller.ConceptFormController">
          <property name="commandName"><value>command</value></property>
          <property name="validator">
              <ref bean="conceptFormValidator" />
          </property>
          <property name="formView"><value>/module/legacyui/dictionary/conceptForm</value></property>
          <property name="successView"><value>concept.form</value></property>
      </bean>
    3. Copy the controller to the omod/src/main/java source folder while preserving the original package, in the example above the controller is org.openmrs.web.controller.ConceptFormController.
    4. For bean entries like the one above, it would nice to move everything referenced at the same time to have the page working as expected, e.g in the example above you can see that it references the conceptFormValidator bean and also defines the formView and successView which are paths or request URLS too respectively, most likely they will have URL mappings themselves as described in step 'a' and they need to be moved too along with their controllers if any as described. If the page has no controller, you will need to see the section below for how to move a page with no controller.
    5. Be sure to test that the page is still fully functional after moving it.

...