📄 view.jsp
字号:
<%@page contentType="text/html" import="com.ebuy.entities.*,com.ebuy.businessfacade.ProductFacade"%><%@page pageEncoding="gb2312" errorPage="errorsearch.html"%><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>商品浏览</title> </head> <% String type=request.getParameter("type"); String val=request.getParameter("val"); String strcount=request.getParameter("count"); int count; int totalrecodecount; int pageindex=Integer.parseInt(request.getParameter("page")); java.util.List list=null; Object obj=request.getSession().getAttribute("customer"); CustomerEntity c=(CustomerEntity)obj; int grade; if(c==null) { grade=0; } else { grade=c.getGrade(); } if(type.equalsIgnoreCase("category")) { list=ProductFacade.getByCategoryID(grade,Integer.parseInt(val),8,pageindex); if(strcount==null) { totalrecodecount=ProductFacade.getRecordCountByCategoryID(Integer.parseInt(val)); double d1=totalrecodecount/8.0; double d2=Math.ceil(d1); count=(int)d2; } else { count=Integer.parseInt(strcount); } } else { list=ProductFacade.getByProductNameKey(grade,val,8,pageindex); if(strcount==null) { totalrecodecount=ProductFacade.getRecordCountByProductNameKey(val); double d1=totalrecodecount/8.0; double d2=Math.ceil(d1); count=(int)d2; } else { count=Integer.parseInt(strcount); } } int previndex=(pageindex==1?1:(pageindex-1)); int nextindex=(pageindex<count?(pageindex+1):count); java.util.Iterator<ProductEntity> iter=list.iterator(); %> <body> <table border="0" width="1000" align="center"> <tr> <td colspan="2"> <jsp:include page="includes/head.html"/> </td> </tr> <tr> <td height="600" valign="top" align="left" width="200"> <jsp:include page="includes/left.jsp"/> </td> <td width="100%" height="650" valign="top"> <table id="tbproduct" cellspacing="10" cellpadding="10" border="0" width="750"> <% ProductEntity pe=null; java.text.NumberFormat format=java.text.NumberFormat.getCurrencyInstance(java.util.Locale.PRC); while(iter.hasNext()) { pe=iter.next(); %> <tr> <td> <TABLE width="100%" style="font-size:xx-small;"> <TR> <TD align="center" width="100" rowSpan="5" VALIGN="top"> <img src="ProductImage/<%=pe.getImagename()%>" align="middle" border="0" style="height:95px;width:80px;" /> </TD> <TD> <a href="productdetails.jsp?ID=<%=pe.getProductid()%>" target="_blank" ><%=pe.getProductname()%></a></TD> </TR> <TR> <TD> 价 格:<%=format.format(pe.getUnitprice())%> </TD> </TR> <tr> <TD> 折扣价:<%=format.format(pe.getRealprice())%> </TD> </tr> <tr> <TD>货源: <% if(pe.isNormal()) {%> 正常 <%}else {%> 缺货 <%}%> </TD> </tr> <TR> <form name="frmcart" action="servlets/cartservlet" method="post"> <td> <input type="hidden" name="productid" value="<%=pe.getProductid()%>"> <input type="hidden" name="productname" value="<%=pe.getProductname()%>"> <input type="hidden" name="unitprice" value="<%=pe.getUnitprice()%>"> <input type="hidden" name="realprice" value="<%=pe.getRealprice()%>"> <input type="hidden" name="exectype" value="add"/> <input type="image" src="img/buycar.gif" border="0"/> </td> </form> </TR> </TABLE> </td> <% if(iter.hasNext()) { pe=iter.next(); %> <td> <TABLE width="100%" style="font-size:xx-small;"> <TR> <TD align="center" width="100" rowSpan="5" VALIGN="top"> <img src="ProductImage/<%=pe.getImagename()%>" align="middle" border="0" style="height:95px;width:80px;" /> </TD> <TD> <a href="productdetails.jsp?ID=<%=pe.getProductid()%>" target="_blank" ><%=pe.getProductname()%></a></TD> </TR> <TR> <TD> 价 格:<%=format.format(pe.getUnitprice())%> </TD> </TR> <tr> <TD> 折扣价:<%=format.format(pe.getRealprice())%> </TD> </tr> <tr> <TD>货源: <% if(pe.isNormal()) { out.write("正常"); } else { out.write("缺货"); } %> </TD> </tr> <TR> <form name="frmcart" action="servlets/cartservlet" method="post"> <td> <input type="image" src="img/buycar.gif" border="0"/> <input type="hidden" name="productid" value="<%=pe.getProductid()%>"> <input type="hidden" name="productname" value="<%=pe.getProductname()%>"> <input type="hidden" name="unitprice" value="<%=pe.getUnitprice()%>"> <input type="hidden" name="realprice" value="<%=pe.getRealprice()%>"> <input type="hidden" name="exectype" value="add"/> </td> </form> </TR> </TABLE> </td> <% } %> </tr> <% } %> <tr> <td colspan="2" align="right"> <table> <tr> <td> <a href="view.jsp?type=<%=type%>&&val=<%=val%>&&page=1&&count=<%=count%>" title="第一页" style="font-family:Webdings;font-size:x-small">7</a> </td> <td> <a href="view.jsp?type=<%=type%>&&val=<%=val%>&&page=<%=previndex%>&&count=<%=count%>" title="前一页" style="font-family:Webdings;font-size:x-small">3</a> </td> <td> <a href="view.jsp?type=<%=type%>&&val=<%=val%>&&page=<%=nextindex%>&&count=<%=count%>" title="下一页" style="font-family:Webdings;font-size:x-small">4</a> </td> <td> <a href="view.jsp?type=<%=type%>&&val=<%=val%>&&page=<%=count%>&&count=<%=count%>"title="最后一页" style="font-family:Webdings;font-size:x-small">8</a> </td> <form name="form1" action="view.jsp" method="get"> <td> <select name="page"> <% for(int i=1;i<=count;i++) { %> <option value="<%=i%>" <% if(i==pageindex) { %> selected="true" <% } %> ><%=i%></option> <% } %> </select> </td> <td> <input type="submit" value="Go"> </td> <td> <input type="hidden" name="val" value="<%=val%>"> <input type="hidden" name="type" value="<%=type%>"> <input type="hidden" name="count" value="<%=count%>"> </td> </form> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td colspan="2"> <jsp:include page="includes/foot.html"/> </td> </tr> </table> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -