Home » freemarker-2.3.13 » freemarker.template.utility » [javadoc | source]
public class: Execute [javadoc | source]

All Implemented Interfaces:

Gives FreeMarker the the ability to execute external commands. Will fork a process, and inline anything that process sends to stdout in the template. Based on a patch submitted by Peter Molettiere.

BE CAREFUL! this tag, depending on use, may allow you to set something up so that users of your web application could run arbitrary code on your server. This can only happen if you allow unchecked GET/POST submissions to be used as the command string in the exec tag.

From java:

SimpleHash root = new SimpleHash();

root.put( "exec", new freemarker.template.utility.Execute() );


From your FreeMarker template:

The following is executed:
${exec( "/usr/bin/ls" )}

Method from freemarker.template.utility.Execute Summary:
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from freemarker.template.utility.Execute Detail:
 public Object exec(List arguments) throws TemplateModelException 
    Executes a method call.