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

📄 stockdetails.jsp

📁 Oracle的J2EE Sample
💻 JSP
字号:
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?>
<%--
 * @author  Elangovan
 * @version 1.0
 *
 * Development Environment       : Oracle9i JDeveloper
 * 
 * Name of the File              : StockDetails.jsp
 *
 * Creation/Modification History :
 *
 *    Elangovan     26-Apr-2002      Created
 *
 * Overview of Application       :
 *
 *  This page displays the user portfolio.
 *
--%>
<%@page language="java" %>
<%@ page session="true" %>
<%@ page contentType="text/vnd.oracle.mobilexml; charset=UTF-8" %>

<%@page import="java.util.Collection" %>
<%@page import="java.util.HashMap" %>
<%@page import="java.util.Iterator" %>
<%@page import="oracle.otnsamples.ibfbs.trademanagement.ejb.PortfolioInfo" %>
<%@page import="oracle.otnsamples.ibfbs.trademanagement.ejb.PortfolioValue" %>
<%@page import="oracle.otnsamples.ibfbs.trademanagement.helper.DateFormatter" %>
<%@page import="oracle.otnsamples.ibfbs.utils.FormatUtils" %>
<%@page import="oracle.otnsamples.ibfbs.usermanagement.ejb.AccountInfo" %>

<!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" 
                "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd">

<% 

    // Get the user portfolio
    HashMap hm = (HashMap) session.getAttribute("MOBILE-PORTFOLIO.RESPONSE");
    
    // Retrieve the Collection values set in the Hashmap
    Collection pfValuation = (Collection)hm.get("PORTFOLIOVALUATION");

    String hasPrev = "false";
    String hasNext = "false";
        
    Collection pfCollection = null;
    String totalAssetValue  = "0";
    
    Iterator retIter = pfValuation.iterator();

        
    if (retIter.hasNext()) {
      hasPrev = (String)retIter.next();
      hasNext = (String)retIter.next();
        
      pfCollection = (Collection)retIter.next();
          
      totalAssetValue = FormatUtils.formatFloatToString(((Float)retIter.next()).floatValue());
    }  

    // 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("PORTFOLIO.RESPONSE");
        
    String availBalance = FormatUtils.formatFloatToString(acInfo.getAccountBalance());
    
    // Get the lines per page
    int linesPerPage = acInfo.getLinesPerPage().intValue(); 
    
    if (recordNum == null) recordNum = "1";
%>

<SimpleResult>

  <SimpleContainer>

    <SimpleText>     
      <SimpleTextItem>My Portfolio</SimpleTextItem>
    </SimpleText>  
    <SimpleBreak/>

    <SimpleText>     
      <SimpleTextItem>Account Balance : <%=availBalance%></SimpleTextItem>      
    </SimpleText>  
    <SimpleBreak/>          
     
        <% 

           Iterator pvIter  = pfCollection.iterator();

           // Empty portfolio
           if(!pvIter.hasNext()) { 
           
        %>
           <SimpleText>
             <SimpleTextItem>No Transactions.</SimpleTextItem>
           </SimpleText>       
        <%
           
           } else {
           
             do {
               // Iterate through portfolio and display
               PortfolioValue pfv = (PortfolioValue)pvIter.next();
        %>
             
            <SimpleText>     
              <SimpleTextItem>Date : <%= DateFormatter.getStringFromDate(pfv.getPurchaseDate(), "dd-MMM-yyyy") %></SimpleTextItem>
              <SimpleTextItem>Symbol : <%=pfv.getSymbol()%></SimpleTextItem>
              <SimpleTextItem>Price : <%=pfv.getPrice()%></SimpleTextItem>
              <SimpleTextItem>G or L : <%=FormatUtils.formatFloatToString(pfv.getGainorloss())%></SimpleTextItem>
              <SimpleTextItem>Qty :<%=pfv.getQuantity()%></SimpleTextItem>
            </SimpleText>  
            <SimpleBreak/>
                  
        
        <%
           } while (pvIter.hasNext()); 
         }
        %>
        
     <SimpleMenu>
         <SimpleTitle>Go to</SimpleTitle>         
         <%  
           // 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")) { 
           
           // If there are some more previous records, display the prev button
           if (hasPrev.equals("true")) {
             int prev = Integer.parseInt(recordNum) - linesPerPage;
         %>
             <SimpleMenuItem target="controllerservlet?EVENTNAME=MOBILE-PORTFOLIO&amp;RECORDNUM=<%=prev%>">Prev</SimpleMenuItem>
         <%
           } 
           // If there are some more next records, display the next button
           if (hasNext.equals("true")) {
             int next = Integer.parseInt(recordNum) + linesPerPage;
         %>
             <SimpleMenuItem target="controllerservlet?EVENTNAME=MOBILE-PORTFOLIO&amp;RECORDNUM=<%=next%>">Next</SimpleMenuItem>
         <%
           } 
           
          } 
         %>    
         
         
         <SimpleMenuItem target="controllerservlet?EVENTNAME=MOBILE-MYHOME">Home</SimpleMenuItem>
         <SimpleMenuItem target="controllerservlet?EVENTNAME=MOBILE-BUY">Buy</SimpleMenuItem>
         <SimpleMenuItem target="controllerservlet?EVENTNAME=MOBILE-SELL">Sell</SimpleMenuItem>
         <SimpleMenuItem target="controllerservlet?EVENTNAME=MOBILE-TRANS">View Trans</SimpleMenuItem>
     </SimpleMenu>
    
   </SimpleContainer>

</SimpleResult>

⌨️ 快捷键说明

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