title: Rythm template engine in websphere
body: <p>I have the following template for generation of an email.</p>
  
  <pre><code>@import java.text.SimpleDateFormat
  @import com.sydneywater.otc.persistence.*
  @import java.text.NumberFormat
  @args(){
  com.sydneywater.otc.persistence.Application application
  }
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;style&gt;
          table {
              font-family: Segoe UI, Verdana, Arial, helvetica, sans-serif;
              font-size: 14px;
              background-color: #FFFFFF;
          }
  
          th {
              margin-left: 5px;
              margin-right: 5px;
              text-align: left;
          }
  
          td {
              margin-left: 5px;
              margin-right: 5px;
              background-color: #E5E5E5;
          }
      &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;table style="width:100%"&gt;
      &lt;tr&gt;
          &lt;th colspan="2" style="color: white" bgcolor="#7BB9E3"&gt;Applicant Details&lt;/th&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
          &lt;td&gt;Applicant Name&lt;/td&gt;
          &lt;td&gt;@application.getApplicant().getApplicantName()&lt;/td&gt;
      &lt;/tr&gt;&lt;tr&gt;
          &lt;td&gt;Applicant Address&lt;/td&gt;
          &lt;td&gt;@application.getApplicant().getFormattedAddress()&lt;/td&gt;
      &lt;/tr&gt;&lt;tr&gt;
          &lt;td&gt;Date Submitted&lt;/td&gt;
          @{
             SimpleDateFormat stdFormat = new SimpleDateFormat("dd/MM/yyyy");
             String formattedDt = stdFormat.format( application.getDateCreated() ); 
          }
          &lt;td&gt;@formattedDt&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;th colspan="2" style="color: white" bgcolor="#7BB9E3"&gt;Property &amp; Application Details&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Applicant Number&lt;/td&gt;
          &lt;td&gt;@application.getId()&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Applicant Name&lt;/td&gt;
          &lt;td&gt;@application.getApplicationType()&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Asset Number&lt;/td&gt;
          &lt;td&gt;@application.getAsset().getAssetNo()&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Asset Size (mm)&lt;/td&gt;
          &lt;td&gt;@application.getAsset().getAssetSize()&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Asset Material&lt;/td&gt;
          &lt;td&gt;@application.getAsset().getMaterialType()&lt;/td&gt;
      &lt;/tr&gt;
      @{
         NumberFormat fmt =  NumberFormat.getCurrencyInstance(); 
         double totalRetail = 0.0;
         double gst = 0.0;
         double total = 0.0;
         for (ApplicationBilling billing: application.getApplicationBilling()) {
          totalRetail += billing.getRetailAmount();
          gst += billing.getGst();
         }
         total = totalRetail + gst;
      }
      &lt;tr&gt;
          &lt;td&gt;Cost&lt;/td&gt;
          @{
             String retailFormatted = fmt.format(totalRetail)
          }
          &lt;td&gt;@retailFormatted&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;GST&lt;/td&gt;
          @{
            String gstFormatted = fmt.format(gst);
          }
          &lt;td&gt;@gstFormatted&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Total&lt;/td&gt;
          @{
            String totalFormatted = fmt.format(total);
          }
          &lt;td&gt;@totalFormatted&lt;/td&gt;
      &lt;/tr&gt;
      @if (!application.getIsAutoApprovable() ) {
      &lt;tr&gt;
          &lt;td&gt;Turnaround time&lt;/td&gt;
          &lt;td&gt;To be implemented&lt;/td&gt;
      &lt;/tr&gt;
      }
  &lt;/table&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is working fine in Tomcat 7 but when I deploy the application as WAR package I get the below error. Does anyone know a fix for this?</p>
  
  <p>Thanks</p>
  
  <pre><code>**Error 500: org.springframework.web.util.NestedServletException: Request processing failed&amp;#59; nested exception is org.rythmengine.exception.CompileException: Syntax error on token &amp;quot;class&amp;quot;, @ expected**
  
  Template: C:/Program Files &amp;#40;x86&amp;#41;/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/HWJ4TY10Node05Cell/otc-services-0_0_1-SNAPSHOT_war.ear/otc-services-0.0.1-SNAPSHOT.war/WEB-INF/classes/template/email/submit_notify.html
  
  Relevant template source lines:
  -------------------------------------------------
     1: @import java.text.SimpleDateFormat
     2: @import com.sydneywater.otc.persistence.*
     3: @import java.text.NumberFormat
     4: @args&amp;#40;&amp;#41;{
     5: com.sydneywater.otc.persistence.Application application
     6: }
     7: &amp;lt;html&amp;gt;
     8: &amp;lt;head&amp;gt;
     9:     &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html&amp;#59; charset=utf-8&amp;quot;&amp;gt;
     10:     &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
     11:     &amp;lt;style&amp;gt;
     12:         table {
     13:             font-family: Segoe UI, Verdana, Arial, helvetica, sans-serif&amp;#59;
     14:             font-size: 14px&amp;#59;
     15:             background-color: #FFFFFF&amp;#59;
     16:         }
     17: 
     18:         th {
     19:             margin-left: 5px&amp;#59;
     20:             margin-right: 5px&amp;#59;
     21:             text-align: left&amp;#59;
     22:         }
     23: 
     24:         td {
     25:             margin-left: 5px&amp;#59;
     26:             margin-right: 5px&amp;#59;
     27:             background-color: #E5E5E5&amp;#59;
     28:         }
     29:     &amp;lt;/style&amp;gt;
     30: &amp;lt;/head&amp;gt;
     31: &amp;lt;body&amp;gt;
     32: &amp;lt;table style=&amp;quot;width:100&amp;#37;&amp;quot;&amp;gt;
     33:     &amp;lt;tr&amp;gt;
     34:         &amp;lt;th colspan=&amp;quot;2&amp;quot; style=&amp;quot;color: white&amp;quot; bgcolor=&amp;quot;#7BB9E3&amp;quot;&amp;gt;Applicant Details&amp;lt;/th&amp;gt;
     35:     &amp;lt;/tr&amp;gt;
     36: 
     37:     &amp;lt;tr&amp;gt;
     38:         &amp;lt;td&amp;gt;Applicant Name&amp;lt;/td&amp;gt;
     39:         &amp;lt;td&amp;gt;@application.getApplicant&amp;#40;&amp;#41;.getApplicantName&amp;#40;&amp;#41;&amp;lt;/td&amp;gt;
     40:     &amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;
     41:         &amp;lt;td&amp;gt;Applicant Address&amp;lt;/td&amp;gt;
     42:         &amp;lt;td&amp;gt;@application.getApplicant&amp;#40;&amp;#41;.getFormattedAddress&amp;#40;&amp;#41;&amp;lt;/td&amp;gt;
     43:     &amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;
     44:         &amp;lt;td&amp;gt;Date Submitted&amp;lt;/td&amp;gt;
     45:         @{
     46:            SimpleDateFormat stdFormat = new SimpleDateFormat&amp;#40;&amp;quot;dd/MM/yyyy&amp;quot;&amp;#41;&amp;#59;
     47:            String formattedDt = stdFormat.format&amp;#40; application.getDateCreated&amp;#40;&amp;#41; &amp;#41;&amp;#59; 
     48:         }
     49:         &amp;lt;td&amp;gt;@formattedDt&amp;lt;/td&amp;gt;
     50:     &amp;lt;/tr&amp;gt;
     51:     &amp;lt;tr&amp;gt;
     52:         &amp;lt;th colspan=&amp;quot;2&amp;quot; style=&amp;quot;color: white&amp;quot; bgcolor=&amp;quot;#7BB9E3&amp;quot;&amp;gt;Property &amp;amp; Application Details&amp;lt;/th&amp;gt;
     53:     &amp;lt;/tr&amp;gt;
     54:     &amp;lt;tr&amp;gt;
     55:         &amp;lt;td&amp;gt;Applicant Number&amp;lt;/td&amp;gt;
     56:         &amp;lt;td&amp;gt;@application.getId&amp;#40;&amp;#41;&amp;lt;/td&amp;gt;
     57:     &amp;lt;/tr&amp;gt;
     58:     &amp;lt;tr&amp;gt;
     59:         &amp;lt;td&amp;gt;Applicant Name&amp;lt;/td&amp;gt;
     60:         &amp;lt;td&amp;gt;@application.getApplicationType&amp;#40;&amp;#41;&amp;lt;/td&amp;gt;
     61:     &amp;lt;/tr&amp;gt;
     62:     &amp;lt;tr&amp;gt;
     63:         &amp;lt;td&amp;gt;Asset Number&amp;lt;/td&amp;gt;
     64:         &amp;lt;td&amp;gt;@application.getAsset&amp;#40;&amp;#41;.getAssetNo&amp;#40;&amp;#41;&amp;lt;/td&amp;gt;
     65:     &amp;lt;/tr&amp;gt;
     66:     &amp;lt;tr&amp;gt;
     67:         &amp;lt;td&amp;gt;Asset Size &amp;#40;mm&amp;#41;&amp;lt;/td&amp;gt;
     68:         &amp;lt;td&amp;gt;@application.getAsset&amp;#40;&amp;#41;.getAssetSize&amp;#40;&amp;#41;&amp;lt;/td&amp;gt;
     69:     &amp;lt;/tr&amp;gt;
     70:     &amp;lt;tr&amp;gt;
     71:         &amp;lt;td&amp;gt;Asset Material&amp;lt;/td&amp;gt;
     72:         &amp;lt;td&amp;gt;@application.getAsset&amp;#40;&amp;#41;.getMaterialType&amp;#40;&amp;#41;&amp;lt;/td&amp;gt;
     73:     &amp;lt;/tr&amp;gt;
     74:     @{
     75:        NumberFormat fmt =  NumberFormat.getCurrencyInstance&amp;#40;&amp;#41;&amp;#59; 
     76:        double totalRetail = 0.0&amp;#59;
     77:        double gst = 0.0&amp;#59;
     78:        double total = 0.0&amp;#59;
     79:        for &amp;#40;ApplicationBilling billing: application.getApplicationBilling&amp;#40;&amp;#41;&amp;#41; {
     80:         totalRetail &amp;#43;= billing.getRetailAmount&amp;#40;&amp;#41;&amp;#59;
     81:         gst &amp;#43;= billing.getGst&amp;#40;&amp;#41;&amp;#59;
     82:        }
     83:        total = totalRetail &amp;#43; gst&amp;#59;
     84:     }
     85:     &amp;lt;tr&amp;gt;
     86:         &amp;lt;td&amp;gt;Cost&amp;lt;/td&amp;gt;
     87:         @{
     88:            String retailFormatted = fmt.format&amp;#40;totalRetail&amp;#41;
     89:         }
     90:         &amp;lt;td&amp;gt;@retailFormatted&amp;lt;/td&amp;gt;
     91:     &amp;lt;/tr&amp;gt;
     92:     &amp;lt;tr&amp;gt;
     93:         &amp;lt;td&amp;gt;GST&amp;lt;/td&amp;gt;
     94:         @{
     95:           String gstFormatted = fmt.format&amp;#40;gst&amp;#41;&amp;#59;
     96:         }
     97:         &amp;lt;td&amp;gt;@gstFormatted&amp;lt;/td&amp;gt;
     98:     &amp;lt;/tr&amp;gt;
     99:     &amp;lt;tr&amp;gt;
     100:         &amp;lt;td&amp;gt;Total&amp;lt;/td&amp;gt;
     101:         @{
     102:           String totalFormatted = fmt.format&amp;#40;total&amp;#41;&amp;#59;
     103:         }
     104:         &amp;lt;td&amp;gt;@totalFormatted&amp;lt;/td&amp;gt;
     105:     &amp;lt;/tr&amp;gt;
     106:     @if &amp;#40;!application.getIsAutoApprovable&amp;#40;&amp;#41; &amp;#41; {
     107:     &amp;lt;tr&amp;gt;
     108:         &amp;lt;td&amp;gt;Turnaround time&amp;lt;/td&amp;gt;
     109:         &amp;lt;td&amp;gt;To be implemented&amp;lt;/td&amp;gt;
     110:     &amp;lt;/tr&amp;gt;
     111:     }
     112: &amp;lt;/table&amp;gt;
     113: 
     114: &amp;lt;/body&amp;gt;
     115: &amp;lt;/html&amp;gt;
  </code></pre>