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

📄 buystock.jsp

📁 Oracle的J2EE Sample
💻 JSP
字号:
<%--
 * @author  Pushkala
 * @version 1.0
 *
 * Development Environment : Oracle9i JDeveloper
 * 
 * Name of the File : BuyStock.jsp
 *
 * Creation/Modification History  :
 *    Pushkala     26-Apr-2002      Created
 *
 * Overview of Application        :
 *
 *   This page is part of the IBFBS application.
 *   This page displays a form where the user can enter the required Stock Symbol
 *   and the quantity of Stocks which the user wishes to buy.
 *
--%>

<%@page contentType="text/html;charset=WINDOWS-1252" language="java" %>

<html>
<head>
<title>OTN Financial Brokerage System : Buy Stock 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="JavaScript">

  // Function to validate the inputs entered for the buy stock transaction
  function validateBuy() {

    var symbol = document.BUY.SYMBOL.value;
    var quantity = document.BUY.QUANTITY.value;

    // If the symbol is not entered, alert the user
    if (symbol == "") {
      alert("Symbol should be entered");
      return;
    }

    // If the quantity is not entered, alert the user
    if (quantity == "") {
      alert("Quantity should be entered");
      return;
    }

    // If Quantity is not a number, alert the user
    if (isNaN(quantity)) {
      alert("Quantity should be a number");
      return;
    }

    // If Quantity is less than or equal to zero, alert the user
    if (quantity <= 0) {
      alert("Quantity should be greater than zero");
      return;
    }

    // Submit the form      
    document.BUY.submit();      
  }

  // Function to reset the data entered by the user
  function resetBuy() {
    document.BUY.SYMBOL.value = "";
    document.BUY.QUANTITY.value = "";
    document.BUY.NOTES.value = "";    
  }
  
  // Function to open a new window and display the list of symbols 
  function showSymbols(frmName) {
    var settings = "width=400,height=320,resizable=no,menubar=no,toolbar=no,"+
                   "directories=no,location=no,scrollbars=no,status=no";
    window.open("controllerservlet?EVENTNAME=SYMBOLLOOKUP&FORMNAME="+frmName,"symbollookup",settings);
  }
  
</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"/>

<jsp:include page="ShowError.jsp" flush="true"/>

<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"> 
      <table width="70%" align="center">
        <tr> 
          <td valign="top" align="center"> 

          <% 
            String tab = request.getParameter("EVENTNAME");
            
            // Information messages to be displayed to the user
            String infoMessage = (String)request.getAttribute("InfoMessage");
            
            // Clear the information message
            request.removeAttribute("InfoMessage"); 
            
            String symbol   = "";
            String quantity = "";
            
            if (tab.equals("BUYSTOCK") && (infoMessage == null)) {
              symbol   = request.getParameter("SYMBOL");
              quantity = request.getParameter("QUANTITY");
            }
            
          %>
            <br>
            <b><font face="Verdana, Times New Roman, Times, serif" color="#990000" size="2">
               Buy Stock
            </font></b>
            <br><br><br><br>
            <form name="BUY" method="post" action="controllerservlet">
              <table width="100%" border="0">
                <tr> 
                  <th class="leftHead" height="30"> 
                    <div align="right">Symbol&nbsp;</div>
                  </th>
                  <td height="30"> 
                    <input type="text" name="SYMBOL" size="16" value="<%=symbol%>">
                    <a href="javascript:showSymbols('BUY')">
                      <img src="images/lookup.gif" alt="List of Symbols" border="0"></a>
                    <input type="hidden" name="EVENTNAME"     value="BUYSTOCK">
                    <input type="hidden" name="CALLOUT_EVENT" value="BUY">
                  </td>
                </tr>
                <tr> 
                  <th class="leftHead" height="30"> 
                    <div align="right">Quantity&nbsp;</div>
                  </th>
                  <td height="30"> 
                    <input type="text" name="QUANTITY" size="16" value="<%=quantity%>">
                  </td>
                </tr>
                <tr> 
                  <th class="leftHead" height="30"> 
                   <div align="right">Notes (#)&nbsp;</div>
                  </th>
                  <td height="30"> 
                    <input type="text" name="NOTES" size="30">
                  </td>
                </tr>
              </table>
      
              <table width="100%" border="0" cellpadding="4" cellspacing="4">
                <tr>
                  <td height="1">&nbsp;</td>
                  <td height="1">&nbsp;</td>
                </tr>
                <tr>
                  <td>
                    <div align="right"><img src="images/submit.gif" alt="Buy" onMouseUp="validateBuy();"></div>
                  </td>
                  <td><img src="images/reset.gif" alt="Reset" onMouseUp="resetBuy();"></td>
                </tr>
              </table>
            </form>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

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

</body>
</html>

⌨️ 快捷键说明

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