📄 maintaincart.jsp
字号:
<!--
Copyright 2006 Borys Burnayev
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<html:html locale="true">
<head>
<title>
<bean:message key="welcome.title" />
</title>
<html:base />
<link rel="stylesheet" type="text/css" href="../css/petstore.css" />
<script type="text/javascript">
function submitForm(action) {
document.getElementsByName("action")[0].value = action;
document.getElementsByName("maintainCartForm")[0].submit();
}
</script>
</head>
<body class="bodystyle" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0">
<logic:notPresent name="maintainCartForm">
<div class="categoryName">
Your shopping cart is empty
</div>
</logic:notPresent>
<logic:present name="maintainCartForm">
<div class="categoryName">
<logic:notEmpty name="maintainCartForm" property="orderItems">Your Shopping Cart</logic:notEmpty>
<logic:empty name="maintainCartForm" property="orderItems">Your shopping cart is empty</logic:empty>
</div>
<logic:notEmpty name="maintainCartForm" property="orderItems">
<html:form action="/checkout">
<html:hidden property="action" value="update" />
<table cellspacing="1" cellpadding="4">
<tr class="tableHeader">
<th></th>
<th>
Item ID
</th>
<th>
Item Name
</th>
<th>
In Stock
</th>
<th>
Unit Price
</th>
<th>
Quantity
</th>
<th>
Extended Price
</th>
</tr>
<logic:iterate id="orderItem" name="maintainCartForm" property="orderItems" type="com.rdacorp.petstore.domain.OrderItem" indexId="i">
<tr class="tableRow">
<td>
<html:link action="/removeItem" paramId="itemCode" paramName="orderItem" paramProperty="item.code">
<html:img src="images/remove.gif" alt="Remove" border="0" />
</html:link>
</td>
<td>
<bean:write name="orderItem" property="item.code" />
</td>
<td>
<bean:write name="orderItem" property="item.product.name" />
</td>
<td>
<logic:greaterThan name="orderItem" property="item.availableQuantity" value="0">
Yes
</logic:greaterThan>
<logic:lessEqual name="orderItem" property="item.availableQuantity" value="0">
No
</logic:lessEqual>
</td>
<td>
<bean:write format="$#,##0.00;$(#,##0.00)" name="orderItem" property="item.price" />
</td>
<td>
<html:text name="maintainCartForm" property='<%= "orderItem[" + i + "].quantity" %>' />
</td>
<td>
<bean:write name="orderItem" property="extendedPrice" format="$#,##0.00;$(#,##0.00)" />
</td>
</tr>
</logic:iterate>
<tr class="tableHeader">
<th>
</th>
<th>
</th>
<th>
</th>
<th>
</th>
<th>
</th>
<th>
</th>
<th>
</th>
</tr>
</table>
<div class="categoryDescription" style="margin-top: 20">
<html:img border="0" src="images/updatecart.gif" alt="Update Cart" onclick="submitForm('update')" style="cursor: pointer" />
</div>
<div class="categoryDescription">
<html:img border="0" src="images/checkout.gif" alt="Checkout" onclick="submitForm('checkout')" style="cursor: pointer" />
</div>
</html:form>
<div>
<html:errors />
</div>
</logic:notEmpty>
</logic:present>
<logic:present name="account">
<div class="heading1">
Favorite Category:
<logic:present name="account" property="person.favoriteCategory">
<bean:write name="account" property="person.favoriteCategory.name" />
</logic:present>
</div>
<table cellspacing="1" cellpadding="4">
<tr class="tableHeader">
<th>
Product ID
</th>
<th>
Name
</th>
</tr>
<logic:iterate id="product" name="products" type="com.rdacorp.petstore.domain.Product">
<tr class="tableRow">
<td>
<html:link action="/displayProduct" paramId="productCode" paramName="product" paramProperty="code">
<bean:write name="product" property="code" />
</html:link>
</td>
<td>
<bean:write name="product" property="name" />
</td>
</tr>
</logic:iterate>
<tr class="tableHeader">
<th>
</th>
<th>
</th>
</tr>
</table>
</logic:present>
</body>
</html:html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -