myhome.jsp

来自「Oracle的J2EE Sample」· JSP 代码 · 共 174 行

JSP
174
字号
<%--
 * @author Umesh Kulkarni
 * @version 1.0
 *
 * Development Environment : Oracle9i JDeveloper
 * 
 * Name of the File : MyHome.jsp
 *
 * Creation/Modification History  :
 *    Umesh     26-Apr-2002      Created
 *    Elango    05-May-2002      Modified
 *
 * Overview of Application        :
 *
 *   This page is part of the IBFBS application.
 *   This page displays the User's Personalized Information such as Financial News of 
 *   user's preferred Stock Symbols, Stock Rate Information of user's preferred 
 *   Stock Symbols etc.
 *
 *   This is the page shown after user successfully logs in this FBS.
--%>

<%@page contentType="text/html;charset=WINDOWS-1252" language="java" %>
<%@page import="java.util.Collection" %>
<%@page import="java.net.URLDecoder" %>
<%@page import="java.util.Iterator" %>
<%@page import="oracle.otnsamples.ibfbs.toplink.News" %>
<%@page import="oracle.otnsamples.ibfbs.toplink.Stockrate" %>
<html>
<head>
<title>OTN Financial Brokerage System : My Home 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>");

  // This function validates the form and submits it. The stock rate is 
  // displayed in a new window.
  function submitForm(doEvent,symbol) { 
                      
    if (symbol != "") {
      var queryString = "EVENTNAME="+doEvent+"&SYMBOL="+symbol;
      window.open("controllerservlet?"+queryString,"WaitPopup",
        "width=380,height=300,resizable=no,menubar=no,toolbar=no,directories=no,location=no,scrollbars=no,status=no");  
    }
  }       
//-->
</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=myhome.gif" flush="TRUE"/>

<%
  Collection newsCollection  = (Collection) session.getAttribute("NEWS.RESPONSE");
  Collection ratesCollection = (Collection) session.getAttribute("RATES.RESPONSE");
%>  

<% 
   Iterator newsIter  = newsCollection.iterator();
   Iterator ratesIter = ratesCollection.iterator();
%>

<table width="100%" border="1" cellpadding="0" cellspacing="0" bgcolor="#FFFFEA" bordercolor="#008000" height="80%">
  <tr><td bordercolor="#FFFFEA" valign="top"><table width="100%" border="0">
  <tr>
    <td width="24%" bordercolor="#FFFFEA">
      <% 
         // If the Rates Collection returns results, display them 
         if (ratesCollection.size() > 0) {
      %>
           <br>
             <div align="center">
               <font face="Verdana, Times New Roman, Times, serif" color="#990000" size="2">
                 <b>Stock Prices</b></font>
             </div>
           <br>
      <% } %>
      <table width="90%" align="center" border="0">
        <% 
           // If the Rates Collection returns results, display them 
           if (ratesCollection.size() > 0) {
        %>
             <tr bgcolor="#FFFFEA"> 
               <td class="tabHead" bgcolor="#008000">&nbsp;&nbsp;SYMBOL</td>
               <td class="tabHead" bgcolor="#008000" align="right">PRICE ($)&nbsp;&nbsp;</td>
             </tr>
             <% 
                String color1 = "#FFFFCC";
                String color2 = "#CCFFCC";
                String color = color2;

                while(ratesIter.hasNext()) {
                  Stockrate s1 = (Stockrate)ratesIter.next();
                  if(s1 == null) continue;
                  // Alternate between color1 and color2
                  color = (color.equals(color2))?color1:color2; 
             %>
                  <tr bgcolor="<%=color%>"> 
                   <td class="tableText" height="30">&nbsp;&nbsp;<%=s1.getSymbol()%></td>
                   <td class="tableText" height="30" align="right"><%=s1.getHighprice()%>&nbsp;&nbsp;</td>
                  </tr>
             <% } %>
        <% } else { %>
             <tr bgcolor="#FFFFEA"> 
                <br>
                <td align="center">
                   <font face="Verdana, Times New Roman, Times, serif" color="#006200" size="2">
                     <b>Set Preference to display the required Stock Prices</b></font>
                </td>
             </tr>
        <% } %>
      </table>
    </td>
    <td bordercolor="#FFFFEA"> 
      <% 
         // If the News Collection returns results, display them 
         if (newsCollection.size() > 0) {
      %>
           <br>
             <div align="center">
               <font face="Verdana, Times New Roman, Times, serif" color="#990000" size="2">
                 <b>Company News</b>
               </font>
             </div>
           <br>
      <% } %>
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <% 
           // If the News Collection returns results, display them 
           if (newsCollection.size() > 0) {
        %>
             <% while(newsIter.hasNext()) { 
                  News news = (News) newsIter.next();
                  if(news == null) continue;
             %>
                  <tr> 
                  <td width="10">&nbsp;</td>
                    <td height="30">
                      <a href="javascript:submitForm('SHOWPROFILE','<%=news.getSymbol()%>');"
                         title="Click to view Company Profile" class="newsText">
                          [<%=news.getSymbol()%>]
                      </a>&nbsp;&nbsp;                    
                      <a href="<%=URLDecoder.decode(news.getNewsurl(),"UTF-8")%>" target="_blank" class="newsText">
                          <%=news.getNewstitle()%>
                      </a>                     
                    </td>
                  </tr>
            <%  } %>
        <% } else { %>
             <tr bgcolor="#FFFFEA"> 
                <br>
                <td align="center">
                  <font face="Verdana, Times New Roman, Times, serif" color="#006200" size="2">
                    <b>Set Preference to display the required Company News</b>
                  </font>
                </td>
             </tr>
        <% } %>
      </table>
    </td>
  </tr>
  </table></td></tr>
</table>

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

</body>
</html>

⌨️ 快捷键说明

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