And so it begins.

July 16, 2008

Overriding the default addressLayout.jsp

Filed under: openmrs — Tags: — machosry @ 5:42 pm

This week I had to override the existing addressLayout.jsp. At first I was very confused in how to do it so I discussed it with Daniel, Brian and I sent an mail to the dev list. Finally Ben gave me an wonderful example and using that I successfully overriden the default addressLayout.jsp. Actually I tried that before Ben sent me the example but by mistake I extended SimpleFormController for portlet instead of the servlet one. Finally Daniel noticed it and corrected it and I have successfully overridden it. I had to create my own controller since the controller which the portlets usually extends doesnt support formView.  But I think I am wrong in the moduleApplicationContext.xml part which is given below. Must show that to Daniel and cross check it. Or if you find something wrong in that please let me so that I can correct it.

Here’s a screenshot:

So this is how it overrides.

This is how i modified my moduleApplicationContext.xml

<bean id=”addresshierarchyUrlMapping” class=”org.springframework.web.servlet.handler.SimpleUrlHandlerMapping”>
<property name=”mappings”>
<props>
<prop key=”**/addressLayout.portlet”>addressLayoutPortletController</prop>
</props>
</property>
</bean>

<bean id=”addressLayoutPortletController” class=”org.openmrs.module.addresshierarchy.web.controller.AddressLayoutPortletController” >
<property name=”commandName”><value>addressLayout</value></property>
<property name=”commandClass”><value>org.openmrs.module.addresshierarchy.web.controller.AddressLayoutPortletController</value></property>
<property name=”formView”><value>/module/@MODULE_ID@/portlets/addressLayout</value></property>
<property name=”successView”><value>/module/@MODULE_ID@/portlets/addressLayout</value></property>
</bean>

Still I am not done with the backend. I have few doubts hope I will finish it within this week.

But I do face a problem with this. Whenever newPatient form reloads with some validation errors my addressLayout.jsp is missing there.

If someone has solution or suggestion please feel free to drop it here.

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.