正在加载图片...
getservletcontext().removeAttribute("cats")i) private String dispPrice( String price)( () if(1en<=2) return price i e⊥se return"s"+ price substring(0, len-2)+"."+ price substring (len-2)i <html> <head> <title>Shopping Mall</title> </head> <body <table width=600> <tr><td>&nbsp; </tdx<td align="right"> <sif (session. getAttribute("username") nu11) out. print("Not Login. <a href='login. html'>Login Now!</a>") out. print ("Welcome session getAttribute("username")) out. print("&nbsp; &nbsp<a href=\""+ request. getContextPath() /servlet/usercheck?status=\'logout'\">Logout</a>)i)8> tr>< td width="20号 <8 ArrayList cats =(ArrayList) application. getAttribute("cats")i for (int i=0; i< cats. size()ii++) estore Category curcat =(estore Category) cats get(i)i 8> sturla+ curcat getId(8>> curcat. getName() ></a> <br/ <8}//for /td> <tdx<table border=1> <tr><th align="left">Item</thx<th align="left">Price</th> <th align="left">Order</thx</tr> String selectedcat request getParameter("catid") if (selectedcat u11) lectedcat estore EShop. getItems(selectedcat) ();i++) estore Product curItem =(estore Product) items get (i)i <tr> <td><号= curate. getName()号></td> <td><8= dispPrice(String valueof(curItem getPrice()))8></td>getServletContext().removeAttribute("cats"); } private String dispPrice( String price) { int len = price.length(); if (len <= 2) return price; else return "$" + price.substring(0,len -2) + "." + price.substring(len-2); } %> <html> <head> <title>Shopping Mall</title> </head> <body > <table width="600"> <tr><td>&nbsp;</td><td align="right"> <%if (session.getAttribute("username") == null) out.print("Not Login. <a href='login.html'>Login Now!</a>"); else { out.print("Welcome " + session.getAttribute("username")); out.print("&nbsp;&nbsp<a href=\"" + request.getContextPath() + "/servlet/usercheck?status=\'logout\'\">Logout</a>"); }%> </td></tr> <tr><td width="20%"> <% ArrayList cats = (ArrayList) application.getAttribute("cats"); for (int i=0; i< cats.size(); i++) { estore.Category curCat = (estore.Category) cats.get(i); %> <a href="<%= request.getRequestURL() + "?catid=" + curCat.getId() %>"> <%= curCat.getName() %></a> <br/> <%} //for %> </td> <td><table border="1"> <tr><th align="left">Item</th><th align="left">Price</th> <th align="left">Order</th></tr> <% String selectedCat = request.getParameter("catid"); if (selectedCat == null) selectedCat = "1"; ArrayList items = (ArrayList) estore.EShop.getItems(selectedCat); for (int i=0; i< items.size(); i++) { estore.Product curItem = (estore.Product) items.get(i); %> <tr> <td><%= curItem.getName() %></td> <td><%= dispPrice(String.valueOf(curItem.getPrice())) %></td>
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有