Home : Digital Asset Management : Programming OpenEdit : Creating Objects
Creating Objects
This technique is used for velocity programming, and is not needed for a typical HTML-only Website.
Page Value
The clean way to create a Java objects is to use this action:
<page-action name="PageValue.loadPageVariable" bean="today" class="java.util.Date" />
The date is can be found as variable named $today
Note: The page-action should be put in the exact page xconf that needs it. For example index.xconf
Class Tool
To create a java object on the fly in an .html or .xml page, use the following
#set ($variable = $classtool.newInstance( "class path", "constructor argument" ) )
Thus, to create a new dateformat object, we pass in the format to the constructor.
#set ( $dateformat = $classtool.newInstance( "java.text.SimpleDateFormat", "EEE MMM dd, yyyy hh:mm a" ) )
To enable the $classtool you need to add this path action to your _site.xconf
<path-action name="PageValue.getLoader" />
