01 <%@ page import="trail.injection.*,
02 java.text.NumberFormat,
03 javax.naming.InitialContext"%>
04
05 <%!
06 private RecordManager rm = null;
07 public void jspInit () {
08 try {
09 InitialContext ctx = new InitialContext();
10 rm = (RecordManager) ctx.lookup(
11 "EJB3Trail/RecordManagerBean/local");
12 } catch (Exception e) {
13 e.printStackTrace ();
14 }
15 }
16 %>
17
18 <%
19 long sent = Long.parseLong(request.getParameter ("sent"));
20 CalculationRecord rc = rm.getRecord(sent);
21 if (rc == null) {
22 %>
23
24 <html>
25 <head><meta http-equiv="REFRESH" content="3;
26 URL=check.jsp?sent=<%=sent%>"></head>
27 <body>
28 Please wait while I am checking whether the message has arrived.<br/>
29 <a href="calculator.jsp">Go back to Calculator</a>
30 </body>
31 </html>
32
33 <%
34 return;
35 } else {
36 NumberFormat nf = NumberFormat.getInstance();
37 nf.setMaximumFractionDigits(2);
38 %>
39
40 <html>
41 <body>
42 The message was sent at<br/>
43 <b><%=rc.sent%></b>.<br/><br/>
44 The message was processed at<br/>
45 <b><%=rc.processed%></b>.<br/><br/>
46 The calculation result (total investment) is
47 <b><%=nf.format(rc.result)%></b>.<br/>
48
49 <a href="calculator.jsp">Go back to Calculator</a>
50 </body>
51 </html>
52
53 <%
54 return;
55 }
56 %>
|