OLD Step 4 - Make this the homepage for a role

One of the key strengths of the UI Framework (and also something you need to keep in mind while you're programming) is that it's easy for System Administrators to reconfigure the pages that different roles see when they visit a particular URL.

Let's explore that functionality by changing the homepage that you see when you log into the system. First (after having logged in) look at http://localhost:8080/openmrs2/home.page. Note that it's vaguely similar to your helloWorld.gsp page (it also says "Hello") but it's not exactly the same.

Click on the Admin link in the top right, and then click on "Page Mappings" under "Configure Application". To begin with, your system shouldn't have any page mappings set up. Add a new mapping for the page "home", the "System Developer" role, and the mapping "helloWorld". (This is assuming that you are currently logged in as a System Developer. You should choose a role that your logged in user has, and you chose while logging in.) After saving this, close the dialog and click on the OpenMRS logo in the top left of the screen to go "home". Even though the url you are visiting is home.page, the page you are actually seeing is the "helloWorld" page we created before.

For a more realistic use of this feature, go back to Admin -> Page Mappings and set up a mapping for "home" + "System Developer" -> "admin". Now try logging in with the System Developer role and going to the homepage. You'll actually see the System Administration page instead.

In the OpenMRS 2.x reference application you may do Role-based page mappings, but the framework itself is more general. If you are building your own UI you may do a custom implementation of the org.openmrs.ui2.core.page.PageRequestMapper interface. (For example if the user is on a mobile device, send them to a specific mobile url.)