getbasket.jsp

来自「实现一个网络购物」· JSP 代码 · 共 41 行

JSP
41
字号
<%
String productsStr = "<br><br><b>The products which have been ordered</b><br><br>"
        + "<table border=\"1\" cellspacing=\"0\" cellpadding=\"3\"><tr><th>Product number</th><th>Name</th>"
        + "<th>Price</th><th>Memberprice</th><th>Number of items</th></tr>";
String memberTmp = memberId;
while(products.size()>0) { 
    String thisProduct = (String) products.firstKey();
    int numberOfItems = Integer.parseInt((String) products.get(thisProduct));
    products.remove(thisProduct);
    memberId = "";
    int price = 0;
    %><mm:node number="<%= thisProduct %>" notfound="skipbody"
    ><%@include file="../includes/getprice.jsp"
    %><mm:field name="title" jspvar="title" vartype="String" write="false"
    ><mm:field name="id" jspvar="id" vartype="String" write="false"><%
        productsStr += "<td  align=\"center\" valign=\"top\">" + id
                    + "</td><td align=\"left\" valign=\"top\">" + title
                    + "</td><td align=\"right\" valign=\"top\">";
        if(price==-1) { 
                productsStr += "unspecified";
        } else {
                productsStr += "&euro; " + nf.format(((double) price )/100);
        }
    %></mm:field
    ></mm:field
    ><% memberId = "dummy";
    %><%@include file="../includes/getprice.jsp"
    %></mm:node><%
        productsStr += "</td><td align=\"right\" valign=\"top\">";
        if(price==-1) { 
            productsStr += "unspecified";
        } else {
            productsStr += "&euro; " + nf.format(((double) price )/100);
        }
        productsStr += "</td><td align=\"center\" valign=\"top\">" + numberOfItems
                    + "</td></tr>";
}
productsStr += "</table>";
memberId = memberTmp;
%>

⌨️ 快捷键说明

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