📄 shopping.jsp
字号:
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@page contentType="text/html; charset=GBK"%>
<html:html>
<head>
<title>商品浏览</title>
<script language="JavaScript" type="text/javascript" >
function doDifferent(obj,item)
{
if(obj == 'addproduct'){
while(item.tagName!="TR"){
item = item.parentElement;
}
if(item.tagName!="TR") return;
document.shoppingForm.id.value = item.cells(0).children(0).value;
document.shoppingForm.quantity.value = item.cells(3).children(0).value;
}
document.shoppingForm.event.value= obj;
document.shoppingForm.submit();
}
</script></head>
<body>
<html:form action="/shoppingAction.do" method="POST">
<html:hidden property="event"/>
<html:hidden property="quantity"/>
<html:hidden property="id"/>
<table width="100%" border="0">
<tr>
<td bgcolor="#EEEEEE">
<div align="center"> 商品浏览
<table border="0" cellspacing="2" cellpadding="5" bgcolor="#008800">
<tr bgcolor="#cccccc">
<td>商品名称</td>
<td>商品描述</td>
<td>价格</td>
<td>购买数量</td>
<td colspan="2">操作</td>
</tr>
<logic:iterate id="item" name="shoppingForm" property="productList">
<tr bgcolor="#ffff88">
<td>
<html:hidden name="item" property="productId"/>
<bean:write name="item" property="name"/>
</td>
<td>
<bean:write name="item" property="note"/>
</td>
<td>
<bean:write name="item" property="price" format="####.##"/>
</td>
<td>
<input type="text"/>
</td>
<td>
<html:button property="" onclick="doDifferent('addproduct',this)">放入购物车</html:button>
</td>
</tr>
</logic:iterate>
</table>
</div>
</td>
</tr>
</table>
<div align="center">
<html:button property="" value="查看购物车" onclick="doDifferent('viewcart')"/>
</div>
</html:form>
</body>
</html:html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -