6.3. Page Auto Mapping

You should use the Click page automapping configuration feature. See the Page Automapping topic for details.

Automapping will save you from having to manually configure URL path to Page class mappings in your click.xml file. If you follow this convention it is very easy to maintain and refactor applications.

You can also quickly determine what the corresponding Page class is for a page HTML template and visa versa, and if you use the ClickIDE Eclipse plugin you can switch between a page's class and template by pressing Ctrl+Alt+S.

An example click.xml automapping configuration is provided below (automapping is enabled by default):

<click-app>
  <pages package="com.mycorp.dashboard.page"/>
</click-app>

To see how the page templates are mapped to Page classes set the application mode to debug and at startup the mappings will be listed out. An example Click startup listing is provided below:

[Click] [debug] automapped pages:
[Click] [debug] /category-tree.htm -> com.mycorp.dashboard.page.CategoryTree
[Click] [debug] /process-list.htm -> com.mycorp.dashboard.page.ProcessList
[Click] [debug] /user-list.htm -> com.mycorp.dashboard.page.UserList