JSP modifications
OpenCms 6 has a modified Java package structure. Therefore it is necessary
to change the imports or the fully qualified object names when you use objects of
the OpenCms packages in your scriplet code. Without those changes, your JSPs
will not be able to compile anymore.
What to do?
<cms> Taglib
When you use the OpenCms taglib in your template, no changes have to be done here as the
<cms> taglib is used the same way as before.
Scriplet code
When using scriplet code in your JSP, several changes are required to make
them compile again.
Because of the new OpenCms package structure, several of the often
used objects like the CmsJspActionElement are now found in new packages. See the following table
how to adjust the imports or fully qualified object names:
Old package name |
New package name |
Description |
com.opencms.flex.jsp.* |
org.opencms.jsp.* |
The
OpenCms JSP package, containing the JspActionElement. |
com.opencms.file.* |
org.opencms.file.* |
The
OpenCms File package, containing the CmsObject. |
com.opencms.core.* |
org.opencms.main.* |
The
OpenCms main/core package, including the OpenCms constants. |
com.opencms.flex.util.CmsMessages |
org.opencms.i18n.CmsMessages |
The
messages object for localization. |
com.opencms.* |
org.opencms.* |
All
other OpenCms packages. |
Please note: Some very few objects have been moved to other packages as before.
Therefore you should also take a look in the OpenCms JavaDocs to see where
those objects can be found now.
One example for modifiying the imports would be:
Imports in OpenCms 5:
<%@page session="false" import="com.opencms.flex.jsp.*, com.opencms.file.*, com.opencms.core.*, java.util.*" %>
Imports in OpenCms 6:
<%@page session="false" import="org.opencms.jsp.*, org.opencms.file.*, org.opencms.main.*, java.util.*" %>
By adjusting the imports and fully qualified object names, you should be able
to get almost all OpenCms 5 JSPs to work in OpenCms 6. For those JSPs which
still will produce compile erros after that, take a look at changes in the OpenCms API.
Technical Background
The package structure in OpenCms 5 had all OpenCms
classes in the com.opencms packages. This changed with OpenCms 6 where
the package structure has been modified to org.opencms . The
only exceptions are the so called legacy classes which are needed for
compability reasons. For example the old XMLTemplate mechanism is now part of those
legacy packages. The legacy classes were kept in the old package structure, so
they still can be found in the com.opencms
packages.
For more details which classes could be found where, please refer to the
OpenCms JavaDocs.
|