01 <%@ page contentType="text/html; charset=Shift_JIS" %>
02 <%@ page import="javax.naming.*,
03 java.text.*,
04 java.util.*,
05 trail.entity.beans.*, trail.apptrans.*"%>
06
07 <%!
08 private NumberFormat nf = null;
09
10 public void jspInit () {
11 nf = NumberFormat.getInstance();
12 nf.setMaximumFractionDigits(2);
13 }
14 %>
15
16 <%
17 Calculator cal =
18 (Calculator) session.getAttribute("apptrans_cal");
19 if (cal == null) {
20 try {
21 InitialContext ctx = new InitialContext();
22 cal = (Calculator) ctx.lookup(
23 "EJB3Trail/ApptransCalculator/local");
24 session.setAttribute ("apptrans_cal", cal);
25 } catch (Exception e) {
26 e.printStackTrace ();
27 }
28 }
29
30 if ("Update".equals(request.getParameter("action"))) {
31 if ("yes".equals(request.getParameter("ts"))) {
32 cal.updateTimestamp();
33 }
34 // Commit the changes by removing the bean
35 cal.checkout ();
36 session.setAttribute ("apptrans_cal", null);
37 %>
38
39 <html>
40 <body>
41 <center>
42 <!--p><b>The changes have been persisted to the database</b></p-->
43 <p><b>変更はデータベースへ永続化されました</b></p>
44 <!--p><a href="update.jsp">Go back to the update screen</a></p-->
45 <p><a href="update.jsp">更新画面に戻る</a></p>
46 </center>
47 </body>
48 </html>
49
50 <%
51 } else {
52 %>
53
54 <html><body>
55
56 <!--p>Do you want to update the timestamps as well?<br/-->
57 <p>タイムスタンプも更新しますか?<br/>
58 <form action="update2.jsp" method="POST">
59 <input type="hidden" name="action" value="Update"/>
60 <input type="radio" name="ts" value="yes" checked>はい</input>
61 <input type="radio" name="ts" value="no">いいえ</input>
62 <br/>
63 <input type="submit" value="更新"/>
64 <INPUT type="button" value="閉じる" onClick="window.close()"/>
65 </form>
66 </p>
67 </body></html>
68
69 <%
70 }
71 %>
|