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

📄 symbollookup.jsp

📁 Oracle的J2EE Sample
💻 JSP
字号:
<%--
 * @author  Elangovan
 * @version 1.0
 *
 * Development Environment       : Oracle9i JDeveloper
 * 
 * Name of the File              : SymbolLookup.jsp
 *
 * Creation/Modification History :
 *
 *    Elangovan     26-Apr-2002      Created
 *
 * Overview of Application       :
 *
 *     This JSP displays the list of Symbols. Each page is generated based on
 *  the number of symbols and the page number.
 *
 *
--%>

<%-- Set Context type and characterset --%>
<%@page contentType="text/html;charset=WINDOWS-1252" language="java" %>
<%@page import="java.util.List" %>
<%@page import="java.util.Iterator" %>
<%@page import="oracle.otnsamples.ibfbs.toplink.Symbol" %>

<%
    //  Get the forname to which the symbol name has to be sent.
    String frmName = request.getParameter("FORMNAME");
    
    // Default is the first form in the parent document 
    if(frmName == null) frmName="forms[0]";
      
      
%>

<html>

  <head>
  
    <title>OTN FBS : Symbol Lookup</title>
    <meta http-equiv="Content-Type" content="text/html; charset=WINDOWS-1252">
    <link rel="stylesheet" href="includes/contents.css" type="text/css">
    
  </head>
  
  <script>
  
    var symbol="";
    
    // This function writes the symbol value in the parent document
    function sendSymbolToParent() {

      if(symbol == "") {
        alert(" Select a Symbol ");
      } else {
      
        // Write the symbol to the parent documents form field
        window.opener.document.<%=frmName%>.SYMBOL.value=symbol;      
        window.close();
      }  
    }
    
  </script>
  
  <%
    
      // Get the page
      List symbolsPage = (List)session.getAttribute("SYMBOLLOOKUP.RESPONSE");
      session.removeAttribute("SYMBOLLOOKUP.RESPONSE");
      
      String eventMessage = null;
      String pgNumber = request.getParameter("PAGENO");
      
      // Get tha total pages to write page numbers
      int totalPages = ((Integer)session.getAttribute("TOTALPAGES")).intValue();
      session.removeAttribute("TOTALPAGES");

      // Get the current page number            
      int currentPage = 1;
      
      if(pgNumber != null)
        currentPage = Integer.parseInt(pgNumber);
      
      if(symbolsPage == null) {
        eventMessage = " Couldn't get symbols list ";
      }
     
     String color1 = "#FFFFCC";
     String color2 = "#CCFFCC";
     
     String color  = color2;
      
      
  %>
  
  <body text="#000000" bgcolor="#FFFFEA" >
  
    <center>
      <h3 style="Text-Decoration : None" class="newsText" >
        OTN eZee Trading - Symbol Lookup </h3>
    </center>
    
    <table bordercolor="#008000" border="1" width="100%" cellspacing="0" cellpadding="0" >
    
    <tr>
    <td>
    <br>
    
    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr valign="top">
        <td align="center" height="160" >

          <form name="frmSelectSymbol" >
              <%
                 if(eventMessage == null) {
               %>
                   <table>
                     <tr>
                       <th bgcolor="#008000" class="tabHead">Select</th>
                       <th bgcolor="#008000" class="tabHead">Symbol</th>
                       <th bgcolor="#008000" class="tabHead">Company Name </th>
                     </tr>
                <%
                   // Display symbols and the company name
                   Iterator symbolIter = symbolsPage.iterator();
                   
                   while(symbolIter.hasNext()) {
                   
                     Symbol symbol = (Symbol) symbolIter.next();
                     
                     color=(color.equals(color2))?color1:color2;
                %>   
                
                    <tr bgcolor="<%=color%>">
                      <td>
                        <input type="radio" name="SYMBOL" 
                               onClick="symbol='<%=symbol.getSymbol()%>'"> </td>
                      <td class="tableText" ><%=symbol.getSymbol()%> </td>
                      <td class="tableText" ><%=symbol.getCompanyname()%> </td>
                    </tr>
                  
                <% 
                   }
                %>  
                </table>
                </tr>
                <tr>
                <td align="right">
                <% 
                   
                   String url = null; 
                   
                   for(int pageNo=1;pageNo<=totalPages;pageNo++) {
                    
                    url = "controllerservlet?EVENTNAME=SYMBOLLOOKUP&FORMNAME="
                           +frmName+"&PAGENO="+pageNo;
                    
                    if(pageNo != currentPage) {
                    
                %>
                   <a href="<%=url%>"><span class="linkText">
                            <font size="2"><%=pageNo%></font></span></a>&nbsp;
                   
                <%
                    
                    } else {
                %>
                    [<%=pageNo%>]&nbsp;
                <%
                   }    
                  } 
                  if((currentPage+1) <= totalPages) {
                  
                    url = "controllerservlet?EVENTNAME=SYMBOLLOOKUP&FORMNAME="
                          +frmName+"&PAGENO="+(currentPage+1);
                 %> 
                 
                   <a href="<%=url%>"><span class="linkText">
                           <font size="2">Next</font></span></a>&nbsp;
                  
                 <%   
                  }
                %>
                </tr>
                <tr border="0">
                <td align="center">
             
                <a href="javascript:sendSymbolToParent();" ><img border="0" 
                     src="images/ok.gif" align="center"></a>&nbsp;&nbsp;     
              <%
               } else {
                 
               %>
                  <%=eventMessage%>
               <%
               }
                 
              %>
                <a href="javascript:window.close();" ><img src="images/close.gif" 
                        align="center" border="0"></a>
               </form>
              </td>
            </tr>
          </table>  
        </td>
      </tr>
    </table>
    
  </body>
  
</html>

⌨️ 快捷键说明

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