Tuesday, May 22, 2012

Overriding the OpenMRS homepage

I've seen some pretty ugly attempts to override the page you see when you go to .../openmrs/index.htm. And I was in the middle of doing yet another of those ugly attempts when I remembered "Mike has done this recently...".

And good thing I asked. It turns out to be as trivial as just doing this:
/**
 * Takes over /index.htm so users don't see the legacy OpenMRS UI
 */
@Controller
public class HomepageOverrideController {
 
 @RequestMapping("/index.htm")
 public String showOurHomepage() {
  return "forward:/pages/kenyaHome.page";
 }
 
}
No need to do a homepage portlet that does a client-side redirect, or any of the other ugly things I've seen done.

Thanks, Mike, for saving me time, and preventing ugly code.

PS- If you're doing this you should also override the login page at /login.htm

No comments:

Post a Comment