Function detail pages are a detail page mechanism for dynamic functions. Here we describe how to create and configure a detail page for a dynamic function.

Use case

Collect data in a form, which can appear on several pages of the website. Display the results of the user request on one page in the navigation. For example, integration of a search form on several pages of the website and displaying of the search results on one page in the navigation. Since OpenCms 8.0.3 you can use function detail page to define such result pages.

General steps

Following steps are required to create dynamic function and its function detail page:

  • Create dynamic function element inside the module.
  • Create and configure the function detail page for the created dynamic function.
  • Drop the dynamic function to container pages.
  • Drop the function detail page to the website structure using the sitemap editor.

Creating dynamic functions

As only users with the role TEMPLATE_DEVELOPER can edit the dynamic function elements, the function should be created inside the module folder: /system/modules/[module name]/functions/. To hide the function element from "Add content" Dialog set following property:

The drag & drop option is enabled for user with the role WORKPLACE_USERS.

Creating function detail pages

  • Implement the JSP with a form, which should be used on several container pages of the website. Use the value ${cms.functionDetail['Name of the function detail page']} for the attribute action of the <form> tag.
<%@page buffer="none" session="false" taglibs="c,fn,cms" %>
<div class="box box_schema1">
   <form action="${cms.functionDetail['simplecalculator']}" method="post">
        <%-- ... --%>
  • Implement another JSP, which evaluates the form data and generates the HTML output for the detail view.
  • In explorer view create two dynamic function elements in folder /system/modules/[module name]/functions/ of the module. One of the dynamic functions should point to the form JSP and another to the detail page JSP.
  • Edit the module configuration file /system/modules/[module name]/.config and configure the function detail page in the tab "Functions". Add new field "Named function". Define a unique name for the function detail. This should be the same name, which is used in the form JSP as action parameter. After this configuration the function detail page appears in the tab "Function pages" of the "Create page" dialog in the sitemap editor.
  • Edit the property on the template JSP. Set the property value functionDetail=[container name attribute]. As value, use the name attribute of the container, in which the function results should be displayed.

Using a function detail page

  • Drop the dynamic function element with the form into container pages.
  • Open the "Create page" dialog of the sitemap editor.
  • Use the configured function detail page from tab "Function pages" as page model to add new page to the navigation.