📄 stock.jsp.svn-base
字号:
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="ase.assignment.sts.api.*"%>
<%@page import="ase.assignment.sts.utils.STSConstants"%>
<%@page import="ase.assignment.sts.beans.*"%>
<%@page import="java.text.NumberFormat"%>
<%@page import="java.util.Locale"%>
<html>
<head>
<title>Stock Info</title>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<link href="main.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="infodiv"><a href="#">Signin</a> | <a
href="#">help</a> | <a href="#">My Account</a> | <a
href="index.html">home</a></div>
<table id="mt" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<th class="inactiveth">
<div class="activetab"><a onclick="cancelBubble=true;"
href="portfolio.jsp">Portfolio Info</a></div>
</th>
<td> </td>
<th class="activeth">
<div class="inactivetab"><a onclick="cancelBubble=true;"
href="stock.jsp">Stock Info</a></div>
</th>
<td> </td>
<th class="inactiveth">
<div class="inactivetab"><a onclick="cancelBubble=true;"
href="account.jsp">Account</a></div>
</th>
<td> </td>
<th class="inactiveth">
<div class="inactivetab"><a onclick="cancelBubble=true;"
href="portfolio_chart.jsp">Summary Chart</a></div>
</th>
<td> </td>
<td width="100%"> </td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" width="100%" align="center"
border="0" style="background-color: #c3d9ff;">
<tr>
<td height="4px" align="right"
style="padding: 0px; vertical-align: top"></td>
</tr>
</table>
<%
String username = (String) session
.getAttribute(STSConstants.SESSION_USER);
String sPortfolio = request.getParameter("portfolio");
int iPortfolio = 0;
if (sPortfolio != null) {
iPortfolio = Integer.parseInt(sPortfolio);
}
PortfolioEntity[] pes = HandlerFactoryProxy.instance()
.getPortfolioHandler().getAllPortfolios(username);
int iStockAmount = 0;
if (pes != null) {
for (int i = 0; i < pes.length; i++) {
PortfolioEntity p = pes[i];
if (iPortfolio != 0 && p.getId() != iPortfolio) {
continue;
}
%>
<table id="ct" width="100%" cellpadding="2" cellspacing="0" class="ct">
<tr>
<td colspan="2" class="ht">Portfolio: <u><%=p.getName()%></u></td>
</tr>
<tr>
<td width="100px"> </td>
<td>
<table width="100%" cellpadding="2" cellspacing="1"
style="border: 1px solid #80aeff">
<tr style="background-color: #80aeff">
<td>stock id</td>
<td>stock name</td>
<td>init price</td>
<td>amount</td>
<td>last price</td>
</tr>
<%
StockHandler handler = HandlerFactoryProxy.instance().getStockHandler();
StockAssertEntity[] ses = handler.getAllStocks(p.getId());
if (ses == null) {
break;
}
StringBuffer sb = new StringBuffer();
for (int j = 0; j < ses.length; j++) {
StockAssertEntity s = ses[j];
sb.append("<tr>");
sb.append("<td>" + s.getId() + "</td>");
sb.append("<td>" + s.getName() + "</td>");
sb.append("<td>"
+ NumberFormat.getCurrencyInstance(
Locale.CHINESE)
.format(s.getInitPrice()) + "</td>");
sb.append("<td>" + s.getAmount() + "</td>");
sb.append("<td>"
+ NumberFormat.getCurrencyInstance(
Locale.CHINESE).format(handler.getCurrentPrice(s.getId()).getPrice()) + "</td>");
sb.append("</tr>");
iStockAmount++;
}
out.println(sb);
%>
</table>
</td>
</tr>
</table>
<%
}
}
%>
<div class="summary">
<div class="summaryc">you have <%=iStockAmount%> stocks, <%=pes == null ? 0 : pes.length%>
portfolios</div>
</div>
<table id="ct" width="100%" cellpadding="2" cellspacing="0" class="ct">
<tr>
<td colspan="2" class="ht">Operaions</td>
</tr>
<table width="100%" cellpadding="2" cellspacing="1"
style="border: 1px solid #80aeff">
<form name="StockAdd" method="post" action="Stock.do">
<tr>
<td><label>Stock ID:</label></td>
<td><input type="text" name="stockId" id="stockId" /></td>
<td><label>Name:</label></td>
<td><input type="text" name="stockName" id="stockName"/></td>
<td><label>Amount:</label></td>
<td><input type="text" name="stockAmount" id="stockAmount" /></td>
</tr>
<tr>
<td><label>Price:</label></td>
<td><input type="text" name="stockPrice" id="stockPrice" /></td>
<td><label>Portfolio:</label></td>
<td><input type="text" name="stockPort" id="stockPort" /></td>
<td colspan="2" align="right"><input type="submit" name="add"
value="add"> <input type="reset" name="reset"
value="reset"></td>
</tr>
</form>
<form name="StockDelete" method="post" action="Stock.do">
<tr>
<td><label>Stock ID:</label></td>
<td><input type="text" name="stockId" id="stockId" /></td>
<td> </td>
<td> </td>
<td colspan="2" align="right"><input type="submit" name="delete"
value="delete"> <input type="reset"
name="reset" value="reset"></td>
</tr>
</form>
</table>
</body>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -