Apache Struts 2 Documentation > Home > Guides > Core Developers Guide > Configuration Files > struts-default.vm |

Apache Struts 2 Documentation
struts-default.vm
Edit Page Browse Space Add Page Add News
Added by Ted Husted, last edited by Ted Husted on Oct 20, 2006 (view change)

If Velocity is being use, the `struts-default.vm` supplies some VelocityMacros that might be useful.

struts-default.vm

    #macro(bean $bean_name $name)
       #set ($name = $action.bean($bean_name))
    #end

    #macro(includeservlet $name)
      $action.include($name,$req,$res)
    #end

    #macro(url $name)
       #set ($name = $action.bean("org.apache.struts.util.URLBean"))
       $name.setRequest($req)
       $name.setResponse($res)
    #end

    #macro(property $object $property)
    $!{ognl.findValue($property, $object)}
    #end