Step 1: Modifying the template structure
When migrating from OpenCms 5 to OpenCms 6, some modifications have to be
made in the way how your JSP templates are stored inside a module and how they
are accessed by the content pages.
This page describes how to move your JSP templates to the right locations
inside your module, so that they can be found and used by OpenCms 6. To get the
JSP code working again, some additional changes might be necessary which are
described here.
Please note: It is not possible to reuse old style XMLTemplates from OpenCms
4 or OpenCms 5 in OpenCms 6 anymore, therefore these migration steps are
only valid for JSP templates used in OpenCms 5.
The following description will assume that your templates are all stored in a
module named "com.alkacon.mytemplates".
What to do ?
To move your templates into the correct locations, the following steps have
to be done:
- Inside your module (in our example:
/system/modules/com.alkacon.mytemplates/) , copy all JSP templates from the
"jsptemplates" folder into the "templates" folder.
- Make sure that all JSP templates will have a useful
and descriptive title as those JSP templates are now available in the template
selector of the new page dialog.
- Create a list telling which JSP template was included
by which mastertemplate. This will later be used when assigning the JSP
templates to the pages directly.
- Delete all old mastertemplates in the "templates"
folder.
- For each JSP template, you have to set the "template-elements" property which will
be used by the build-in editors to identify the page elements used in this
template. E.g. if your template contains a page element "body", the
value of this property would be "body*|Body". If there is a second page
element "body2", you have to modify the value of the "template-elements"
property of the template to: "body*|Body,body2|2nd Body". Page elements that
are mandatory are marked with a star "*", the string after the pipe "|"
specifies the nice name of the element. See also the template-howto for more information on this subject.
Continue with the next step "Content migration ".
Technical Background
Template structure in OpenCms 5
In OpenCms5, JSP templates still had to use the
old XMLTemplate mechanism as a starting point, which was caused by the way how
JSP templates were integrated into the system. Therefore, you had to create
additional "mastertemplates" which were the templates connected with the content pages. The mastertemplates included
the JSP templates which had the actual layout
of your website. This required the following structure inside your module
(only those folders are listed which are important to convert the template
structure):
Foldername |
Contains |
templates |
Old style xml mastertamplates. Those templates refer to
a JSP template and can be selected when creating a new page in
OpenCms. |
jsptemplates |
JSP
templates, defining the layout of your website. |
elements |
JSP
elements, included by the JSP templates. |
Template structure in OpenCms 6
OpenCms 6 can access the JSP templates directly, so the old XML
mastertemplates are not required anymore and must not be used now. The structure
of the module will now look like this:
Foldername |
Contains |
templates |
JSP
templates, defining the layout of your website. They can be selected when creating a new page in
OpenCms |
elements |
JSP
elements, included by the JSP templates. |
|