Velocity: How to use the outjected variable

Change the default redirection to a freemarker extensions:

  1. install velocity tools view servlet (from jakarta.apache.org)
    <servlet>
      <servlet-name>velocity</servlet-name>
      <servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</servlet-class>
      <!-- path to your velocity toolbox.xml -->
      <init-param>
        <param-name>org.apache.velocity.toolbox</param-name>
        <param-value>/WEB-INF/toolbox.xml</param-value>
      </init-param>
      <!-- path to your velocity.properties -->
      <init-param>
        <param-name>org.apache.velocity.properties</param-name>
        <param-value>/WEB-INF/velocity.properties</param-value>
      </init-param>
    </servlet>
    
    <!-- Map *.vm files to Velocity -->
    <servlet-mapping>
      <servlet-name>velocity</servlet-name>
      <url-pattern>*.vm</url-pattern>
    </servlet-mapping>
  2. add to your vraptor.xml file the following xml tag:
            ...
    
            <regex-view-manager>/$component/$logic.$result.vm</regex-view-manager>
    
            ...
    
  3. That's it!