websphere中的Rythm模板引擎

时间:2015-03-26 05:02:18

标签: rythm

我有以下模板用于生成电子邮件。

@import java.text.SimpleDateFormat
@import com.sydneywater.otc.persistence.*
@import java.text.NumberFormat
@args(){
com.sydneywater.otc.persistence.Application application
}
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <style>
        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;
        }
    </style>
</head>
<body>
<table style="width:100%">
    <tr>
        <th colspan="2" style="color: white" bgcolor="#7BB9E3">Applicant Details</th>
    </tr>

    <tr>
        <td>Applicant Name</td>
        <td>@application.getApplicant().getApplicantName()</td>
    </tr><tr>
        <td>Applicant Address</td>
        <td>@application.getApplicant().getFormattedAddress()</td>
    </tr><tr>
        <td>Date Submitted</td>
        @{
           SimpleDateFormat stdFormat = new SimpleDateFormat("dd/MM/yyyy");
           String formattedDt = stdFormat.format( application.getDateCreated() ); 
        }
        <td>@formattedDt</td>
    </tr>
    <tr>
        <th colspan="2" style="color: white" bgcolor="#7BB9E3">Property & Application Details</th>
    </tr>
    <tr>
        <td>Applicant Number</td>
        <td>@application.getId()</td>
    </tr>
    <tr>
        <td>Applicant Name</td>
        <td>@application.getApplicationType()</td>
    </tr>
    <tr>
        <td>Asset Number</td>
        <td>@application.getAsset().getAssetNo()</td>
    </tr>
    <tr>
        <td>Asset Size (mm)</td>
        <td>@application.getAsset().getAssetSize()</td>
    </tr>
    <tr>
        <td>Asset Material</td>
        <td>@application.getAsset().getMaterialType()</td>
    </tr>
    @{
       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;
    }
    <tr>
        <td>Cost</td>
        @{
           String retailFormatted = fmt.format(totalRetail)
        }
        <td>@retailFormatted</td>
    </tr>
    <tr>
        <td>GST</td>
        @{
          String gstFormatted = fmt.format(gst);
        }
        <td>@gstFormatted</td>
    </tr>
    <tr>
        <td>Total</td>
        @{
          String totalFormatted = fmt.format(total);
        }
        <td>@totalFormatted</td>
    </tr>
    @if (!application.getIsAutoApprovable() ) {
    <tr>
        <td>Turnaround time</td>
        <td>To be implemented</td>
    </tr>
    }
</table>

</body>
</html>

这在Tomcat 7中工作正常但是当我将应用程序部署为WAR包时,我得到以下错误。有谁知道解决这个问题吗?

由于

**Error 500: org.springframework.web.util.NestedServletException: Request processing failed&#59; nested exception is org.rythmengine.exception.CompileException: Syntax error on token &quot;class&quot;, @ expected**

Template: C:/Program Files &#40;x86&#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&#40;&#41;{
   5: com.sydneywater.otc.persistence.Application application
   6: }
   7: &lt;html&gt;
   8: &lt;head&gt;
   9:     &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html&#59; charset=utf-8&quot;&gt;
   10:     &lt;title&gt;&lt;/title&gt;
   11:     &lt;style&gt;
   12:         table {
   13:             font-family: Segoe UI, Verdana, Arial, helvetica, sans-serif&#59;
   14:             font-size: 14px&#59;
   15:             background-color: #FFFFFF&#59;
   16:         }
   17: 
   18:         th {
   19:             margin-left: 5px&#59;
   20:             margin-right: 5px&#59;
   21:             text-align: left&#59;
   22:         }
   23: 
   24:         td {
   25:             margin-left: 5px&#59;
   26:             margin-right: 5px&#59;
   27:             background-color: #E5E5E5&#59;
   28:         }
   29:     &lt;/style&gt;
   30: &lt;/head&gt;
   31: &lt;body&gt;
   32: &lt;table style=&quot;width:100&#37;&quot;&gt;
   33:     &lt;tr&gt;
   34:         &lt;th colspan=&quot;2&quot; style=&quot;color: white&quot; bgcolor=&quot;#7BB9E3&quot;&gt;Applicant Details&lt;/th&gt;
   35:     &lt;/tr&gt;
   36: 
   37:     &lt;tr&gt;
   38:         &lt;td&gt;Applicant Name&lt;/td&gt;
   39:         &lt;td&gt;@application.getApplicant&#40;&#41;.getApplicantName&#40;&#41;&lt;/td&gt;
   40:     &lt;/tr&gt;&lt;tr&gt;
   41:         &lt;td&gt;Applicant Address&lt;/td&gt;
   42:         &lt;td&gt;@application.getApplicant&#40;&#41;.getFormattedAddress&#40;&#41;&lt;/td&gt;
   43:     &lt;/tr&gt;&lt;tr&gt;
   44:         &lt;td&gt;Date Submitted&lt;/td&gt;
   45:         @{
   46:            SimpleDateFormat stdFormat = new SimpleDateFormat&#40;&quot;dd/MM/yyyy&quot;&#41;&#59;
   47:            String formattedDt = stdFormat.format&#40; application.getDateCreated&#40;&#41; &#41;&#59; 
   48:         }
   49:         &lt;td&gt;@formattedDt&lt;/td&gt;
   50:     &lt;/tr&gt;
   51:     &lt;tr&gt;
   52:         &lt;th colspan=&quot;2&quot; style=&quot;color: white&quot; bgcolor=&quot;#7BB9E3&quot;&gt;Property &amp; Application Details&lt;/th&gt;
   53:     &lt;/tr&gt;
   54:     &lt;tr&gt;
   55:         &lt;td&gt;Applicant Number&lt;/td&gt;
   56:         &lt;td&gt;@application.getId&#40;&#41;&lt;/td&gt;
   57:     &lt;/tr&gt;
   58:     &lt;tr&gt;
   59:         &lt;td&gt;Applicant Name&lt;/td&gt;
   60:         &lt;td&gt;@application.getApplicationType&#40;&#41;&lt;/td&gt;
   61:     &lt;/tr&gt;
   62:     &lt;tr&gt;
   63:         &lt;td&gt;Asset Number&lt;/td&gt;
   64:         &lt;td&gt;@application.getAsset&#40;&#41;.getAssetNo&#40;&#41;&lt;/td&gt;
   65:     &lt;/tr&gt;
   66:     &lt;tr&gt;
   67:         &lt;td&gt;Asset Size &#40;mm&#41;&lt;/td&gt;
   68:         &lt;td&gt;@application.getAsset&#40;&#41;.getAssetSize&#40;&#41;&lt;/td&gt;
   69:     &lt;/tr&gt;
   70:     &lt;tr&gt;
   71:         &lt;td&gt;Asset Material&lt;/td&gt;
   72:         &lt;td&gt;@application.getAsset&#40;&#41;.getMaterialType&#40;&#41;&lt;/td&gt;
   73:     &lt;/tr&gt;
   74:     @{
   75:        NumberFormat fmt =  NumberFormat.getCurrencyInstance&#40;&#41;&#59; 
   76:        double totalRetail = 0.0&#59;
   77:        double gst = 0.0&#59;
   78:        double total = 0.0&#59;
   79:        for &#40;ApplicationBilling billing: application.getApplicationBilling&#40;&#41;&#41; {
   80:         totalRetail &#43;= billing.getRetailAmount&#40;&#41;&#59;
   81:         gst &#43;= billing.getGst&#40;&#41;&#59;
   82:        }
   83:        total = totalRetail &#43; gst&#59;
   84:     }
   85:     &lt;tr&gt;
   86:         &lt;td&gt;Cost&lt;/td&gt;
   87:         @{
   88:            String retailFormatted = fmt.format&#40;totalRetail&#41;
   89:         }
   90:         &lt;td&gt;@retailFormatted&lt;/td&gt;
   91:     &lt;/tr&gt;
   92:     &lt;tr&gt;
   93:         &lt;td&gt;GST&lt;/td&gt;
   94:         @{
   95:           String gstFormatted = fmt.format&#40;gst&#41;&#59;
   96:         }
   97:         &lt;td&gt;@gstFormatted&lt;/td&gt;
   98:     &lt;/tr&gt;
   99:     &lt;tr&gt;
   100:         &lt;td&gt;Total&lt;/td&gt;
   101:         @{
   102:           String totalFormatted = fmt.format&#40;total&#41;&#59;
   103:         }
   104:         &lt;td&gt;@totalFormatted&lt;/td&gt;
   105:     &lt;/tr&gt;
   106:     @if &#40;!application.getIsAutoApprovable&#40;&#41; &#41; {
   107:     &lt;tr&gt;
   108:         &lt;td&gt;Turnaround time&lt;/td&gt;
   109:         &lt;td&gt;To be implemented&lt;/td&gt;
   110:     &lt;/tr&gt;
   111:     }
   112: &lt;/table&gt;
   113: 
   114: &lt;/body&gt;
   115: &lt;/html&gt;

0 个答案:

没有答案