第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為什么我index.jsp中的session獲取不到利潤(rùn)集合呢?

public?class?Servlet?extends?HttpServlet?{
????public?void?init()?throws?ServletException{}
????public?void?destroy(){}
????public?void?doGet(HttpServletRequest?request,?HttpServletResponse?response){
????????doPost(request,response);
????}

????public?void?doPost(HttpServletRequest?request,HttpServletResponse?response){
????????Service?service?=?new?Service();
????????try?{
????????????List<Profit>?list?=?service.getProfitList();
????????????request.getSession().setAttribute("ProfitList",list);
????????????response.sendRedirect("index.jsp");
????????}?catch?(Exception?e)?{
????????????e.printStackTrace();
????????}
????}
}
<%@?page?import="java.util.List"?%>
<%@?page?import="com.beans.Profit"?%>
<%@?page?contentType="text/html;charset=UTF-8"?language="java"?%>
<html>
??<head>
????<title>Java原生態(tài)生成報(bào)表</title>
??</head>
??<body>
??<!--?js格式待做?-->

??<table?class=""?>
????<form?action=""?method="post">
??????<tr?><td?colspan="7">商品利潤(rùn)表</td></tr>
??????<tr>
????????<th>商品ID</th>
????????<th>商品名</th>
????????<th>成本價(jià)</th>
????????<th>銷售價(jià)</th>
????????<th>商品總利潤(rùn)</th>
????????<th>交易次數(shù)</th>
????????<th>交易總數(shù)</th>
??????</tr>
??<%
????List<Profit>?list?=?null;
????int?temp?=?0;
????int?temp1?=?0;
????int?temp2?=?0;
????int?temp3?=?0;
????int?temp4?=?0;
????int?temp5?=?0;
????if?(session.getAttribute("ProfitList")!=null){
????if?(list==null)?{
??????list?=?(List<Profit>)?session.getAttribute("ProfitList");
????}
????for?(int?i=0;i<list.size();i++){
??????Profit?p?=?list.get(i);
??????if?(p!=null){
??????????temp1?+=?p.getCostPrice();
??????????temp2?+=?p.getSellingPrice();
??????????temp3?+=?p.getPrfit();
??????????temp4?+=?p.getTimes();
??????????temp5?+=?p.getTradingNumber();
??%>
??????<tr>
????????<td><%=temp++%></td>
????????<td><%=p.getGoodsId()%></td>
????????<td><%=p.getGoodsName()%></td>
????????<td><%=p.getCostPrice()%></td>
????????<td><%=p.getSellingPrice()%></td>
????????<td><%=p.getPrfit()%></td>
????????<td><%=p.getTimes()%></td>
????????<td><%=p.getTradingNumber()%></td>
??????</tr>
??????<%
????????}
????????%>
??????<tr>
????????<td?colspan="2">合計(jì)</td>
????????<td><%=temp1%></td>
????????<td><%=temp2%></td>
????????<td><%=temp3%></td>
????????<td><%=temp4%></td>
????????<td><%=temp5%></td>
??????</tr>
??????<%
??????????}
????????}
??????%>
????</form>
??</table>
??</body>
</html>


正在回答

1 回答

你的合計(jì)在for循環(huán)里 ,放外面試試。

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

moummm 提問者

非常感謝!
2017-10-07 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么我index.jsp中的session獲取不到利潤(rùn)集合呢?

我要回答 關(guān)注問題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)