<![CDATA[Dynamic Function detail page demo]]> The dynamic function resource type make it possible to integrate jsp functionality directly on the website. The function element points to the required  jsp and can be directly dropped in to the container page.

A typical use case is to collect data in a form and to send these data to another jsp for further evaluation, e.g. the integration of a search form on all containerpages of the site.

The result of the evaluation should be displayed in the defined path on the website. Since OpenCms 8.0.3 you can use detail page to define such a result page.

 

To use the detail page for the function elements following steps are required:

  • Definition of the function elements in the module.
  • Configuration of the detail page for the defined function element.
  • dding the detail page for the function element on the website by using the sitemap editor.

 

Configuration of the detail page for a function element 

  1. Implement the form jsp to be used on all container pages of the website. Use the following value "${cms.functionDetail["Name of the function detail"]}" as the "action" attribute of the html form.
  2. Implement the second jsp, which evaluates the form data and generates the html output to be shown as detail page.
  3. Create two function elements using New-Dialog inside of the module, one should point to the form jsp and another to the detail page jsp.
  4. Adjust the module configuration to make the detail page known to the sitemap editor. Add a new field to the tab "Function" of the module configuration. Set "Name of the function detail" in the field name. this should be the same value as used in the form jsp. Select the function element, which should be used as detail page in the field function.
  5. Set the property "continer.info" on the template jsp to following value: functionDetail=centercolumn, where "centercolumn" is the name attribute of the container to show the detail page.

 Using the detail page for the function element in the website

  1. Add the function element with the form using the add wizard somewhere on the website.
  2. Open the sitemap editor and use the create page dialog.
  3. Go to the tab "Function Pages" and drop the function detail page of your module to the sitemap.

 

Compare follwing resources for implementation details:

 /system/modules/org.opencms.dev.demo/.config

/system/modules/org.opencms.dev.demo/functions/

/system/modules/org.opencms.dev.demo/pages/simple-calculator-form.jsp

/system/modules/org.opencms.dev.demo/pages/simple-calculator-result.jsp

/system/modules/org.opencms.dev.demo/templates/main.jsp

 

 

]]>