⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transactionhistory.jsp

📁 Oracle的J2EE Sample
💻 JSP
字号:
<%--
 * @author  Pushkala
 * @version 1.0
 *
 * Development Environment : Oracle9i JDeveloper
 * 
 * Name of the File : TransactionHistory.jsp
 *
 * Creation/Modification History  :
 *    Pushkala     26-Apr-2002      Created
 *
 * Overview of Application        :
 *
 *   This page is part of the IBFBS application.
 *   This page displays the TradeDetails of the transactions carried out by the logged in user.
 *   The user can navigate to this page by clicking the Transaction History link on the LeftList
 *   in the Portfolio tab in the header.
 *
--%>
<%@page contentType="text/html;charset=WINDOWS-1252" language="java" %>
<%@page import="oracle.otnsamples.ibfbs.trademanagement.ejb.TradeDetailsInfo" %>
<%@page import="oracle.otnsamples.ibfbs.usermanagement.ejb.AccountInfo" %>
<%@page import="oracle.otnsamples.ibfbs.trademanagement.helper.DateFormatter" %>
<%@page import="java.util.Collection" %>
<%@page import="java.util.HashMap" %>
<%@page import="java.util.Iterator" %>

<html>
<head>
<title>OTN Financial Brokerage System : Transaction History Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=WINDOWS-1252">
<link rel="stylesheet" href="includes/contents.css" type="text/css">

<SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
<!--
document.write("<SCRIPT LANGUAGE='JavaScript1.2' SRC='includes/tab.js' TYPE='text/javascript'><\/SCRIPT>");
//-->
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript1.2">
  // Function to set the value of recordnumber which is required for page formatting
  function setRecordNum(recNum) {
    formObj = document.PAGEFORMAT;    
    formObj.RECORDNUM.value = recNum;
    formObj.submit();
  }
</SCRIPT>
</head>

<body bgcolor="#FFFFEA" onLoad="MM_preloadImages('images/myhome.gif','images/profile.gif','images/personalize.gif','images/portfolio.gif','images/logout.gif')">

<jsp:include page="Header.jsp?TABIMAGE=portfolio.gif" flush="TRUE"/>

<% 
  String tab = request.getParameter("EVENTNAME"); 
  
  // When the user clicks the Portfolio tab in the header, and clicks the TransactionHistory link 
  // on the left, the event 'TRANS' is sent to the controller servlet which maps the event with 
  // this page using the mapping in control.xml file.
  if (tab.equals("TRANS")) {
    // If the EVENTNAME is TRANS, get the response value into the Hashmap
    java.util.HashMap hm = (java.util.HashMap) session.getAttribute("TRANS.RESPONSE");
    
    // Retrieve the Collection values set in the Hashmap
    Collection retCollection = (Collection)hm.get("TRADEDETAILSINFO");

    Iterator retIter = retCollection.iterator();
        
    String hasPrev = "false";
    String hasNext = "false";
        
    Collection tdCollection = null;
        
    if (retIter.hasNext()) {
      hasPrev = (String)retIter.next();
      hasNext = (String)retIter.next();
        
      tdCollection = (Collection)retIter.next();
    }  

    // Record Number of the first record in the set displayed
    String recordNum = request.getParameter("RECORDNUM"); 
    
    // Get the Account information of the logged in user
    AccountInfo acInfo = (AccountInfo)hm.get("ACCOUNTINFO"); 
    
    hm.clear();
    session.removeAttribute("TRANS.RESPONSE");

    // Get the lines per page
    int linesPerPage = acInfo.getLinesPerPage().intValue(); 
    
    if (recordNum == null) recordNum = "1";
%>

<table width="100%" border="1" cellpadding="0" cellspacing="0" bgcolor="#FFFFEA" bordercolor="#008000" height="80%">
  <tr>
    <td width="20%" bordercolor="#FFFFEA" valign="center" bgcolor="#FFFFD5"> 
      <jsp:include page="LeftList.jsp" flush="TRUE"/>
    </td>
    <td bordercolor="#FFFFEA" valign="top" align="center"> 
      <br>
      <b><font face="Verdana, Times New Roman, Times, serif" color="#990000" size="2">
        Details of all the Stock Trades carried out 
      </font></b>
      <br><br>
      <table width="60%" cellpadding="2" cellspacing="2">
        <% 
           // Set the iterator for the Collection
           Iterator tdIter = tdCollection.iterator();
           int rowCount = 0; // initialize row counter
      
           String color1 = "#FFFFCC";
     String color2 = "#CCFFCC";
     
     String color = color2;

           while (tdIter.hasNext()) {
       TradeDetailsInfo tdif = (TradeDetailsInfo)tdIter.next();

             // Alternate between color1 and color2
             color = (color.equals(color2))?color1:color2; 
                   
       rowCount += 1;
       
       // Display the Table header only once when the row count is 1
       if (rowCount == 1) {
  %>
             <tr> 
               <th bgcolor="#008000" class="tabHead"> 
                 <div align="center">DATE</div>
               </th>
               <th bgcolor="#008000" class="tabHead"> 
                 <div align="center">SYMBOL</div>
               </th>
               <th bgcolor="#008000" class="tabHead"> 
                 <div align="center">ACTION</div>
               </th>
               <th bgcolor="#008000" class="tabHead"> 
                 <div align="center">PRICE ($)</div>
               </th>
               <th bgcolor="#008000" class="tabHead"> 
                 <div align="center">QUANTITY</div>
               </th>
             </tr>
        <%
             }

             // Display the values in the Collection
  %>
             <tr bgcolor="<%=color%>"> 
               <td class="tableText" height="30"> 
                 <div align="center"><%= DateFormatter.getStringFromDate(tdif.getTradeDate(), "dd-MMM-yyyy") %></div>
               </td>
               <td class="tableText" height="30" > 
                 <div align="left">&nbsp;<%=tdif.getSymbol()%></div>
               </td>
               <td class="tableText" height="30"> 
                 <div align="left">&nbsp;<%=tdif.getAction()%></div>
               </td>
               <td class="tableText" height="30"> 
                 <div align="right"><%=tdif.getPrice()%>&nbsp;</div>
               </td>
               <td class="tableText" height="30"> 
                 <div align="right"><%=tdif.getQuantity()%>&nbsp;</div>
               </td>
             </tr>
        <% } %>
        <%  
           // If the page required iteration, set a form with the RECORDNUM to the index of the 
           // first record and the EVENTNAME, display the Prev and Next buttons if required
           if (hasPrev.equals("true") || hasNext.equals("true")) { 
        %>
             <form name="PAGEFORMAT" action="controllerservlet" method="post">
               <input type="hidden" name="EVENTNAME" value="TRANS">
               <input type="hidden" name="RECORDNUM">
             <tr bgcolor="#FFFFEA">
               <td align="center">&nbsp;
               <%
                 // If there are some more previous records, display the prev button
                 if (hasPrev.equals("true")) {
                   int prev = Integer.parseInt(recordNum) - linesPerPage;
               %>
                   <img src="images/prev.gif" alt="Previous" onMouseUp="setRecordNum('<%=prev%>');">
               <%
                 } 
               %>    
               </td>
               <td>&nbsp;</td>
               <td>&nbsp;</td>
               <td>&nbsp;</td>
               <td align="center">
               <%
                 // If there are some more next records, display the next button
                 if (hasNext.equals("true")) {
                   int next = Integer.parseInt(recordNum) + linesPerPage;
               %>
                   <img src="images/next.gif" alt="Next" onMouseUp="setRecordNum('<%=next%>');">
               <%
                 } 
               %>    
               &nbsp;</td>
             </tr>
             </form>
        <%    
           }  
        %>
      </table>
      <%
        // If the row counter is 0, it indicates that no TradeDetails exist for the user
        // Hence display the corresponding message to the user
  if (rowCount == 0) {
      %>
    <font face="Verdana, Times New Roman, Times, serif" color="#008000" size="2">
            <b>No Transactions found for the logged in user...</b>
          </font>
      <%
  }
      %>
    </td>
  </tr>
</table>

<%
  }
%>

<jsp:include page="Footer.jsp" flush="false"/>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -