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