Scriptlets

(Difference between revisions)
Jump to: navigation, search
m
m
Line 1: Line 1:
 
Scriptlets are just JSP files that are composed using regular Java code instead of taglib code. Note that one doesn't exclude the other, so you can even use a mix of the two.
 
Scriptlets are just JSP files that are composed using regular Java code instead of taglib code. Note that one doesn't exclude the other, so you can even use a mix of the two.
  
Choosing between scriptlet code and taglib code is usually just a matter of preference.
+
Choosing between scriptlet code and taglib code is usually just a matter of preference, and a slight mix is not uncommon.
  
A typical scriptlet starts by retrieving the CmsObject, which is often a central access point for many of OpenCms' features.
+
At the start of a scriptlet, you will typically find some kind of CmsJspActionElement and a CmsObject. These two (the CmsObject in particular) are often the central corner stones from which you can access many of OpenCms' features.
  
 
==Example scriptlets==
 
==Example scriptlets==
 
*[[Get the CmsObject]]
 
*[[Get the CmsObject]]
 
*[[Read a property of an arbitrary CmsResource]]
 
*[[Read a property of an arbitrary CmsResource]]
 +
*[[Reading various information about a resource]]

Revision as of 12:09, 6 April 2010

Scriptlets are just JSP files that are composed using regular Java code instead of taglib code. Note that one doesn't exclude the other, so you can even use a mix of the two.

Choosing between scriptlet code and taglib code is usually just a matter of preference, and a slight mix is not uncommon.

At the start of a scriptlet, you will typically find some kind of CmsJspActionElement and a CmsObject. These two (the CmsObject in particular) are often the central corner stones from which you can access many of OpenCms' features.

Example scriptlets

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox