1. Jsp 清空購物車並且返回主頁
找到這個action,在後面返回main.jsp
2. jsp+javabean關於購物車的代碼 哪位大俠幫修改下 十萬火急!!!
temp.getName().equals(MyTools.toChinese(name)))
可能這里判斷出了問題!
3. jsp中購物車下次購買是怎麼把上次的購物車記錄清零代碼
刪除吧 刪除表裡數據 可以給寫 look my name
4. jsp怎麼讓購物車清空
購物車的值存在於session中,清空session中的購物車的值就可以了
5. 求JSP購物車代碼,購物車能夠實現添加、移除、刪除、結算功能,能夠實現用戶評價,生成產品銷量餅圖
JSP的這類的學習型資源目前只有畢設才滿足,所以你還是自己寫比較好,或者只有定做。要別人給你敲好的代碼一般來說是不可能的。
6. jsp購物車代碼
//shopping.html
<html>
<head><title>shopping stor</title></head>
<body>
<form action="carts.jsp" target="post">
<br>
please select the item that you want to buy
<br>
<select name="item">
<option>book:old man and the sea
<option>x-box game machine
<option>mp3 player
<option>cce
<option>book:jsp programming
<option>cd "the endless love"
<option>dvd "gone with the wind"
</select>
<br>
<input type="submit" name="submit" value="add">
<input type="submit" name="submit" value="remove">
</form>
</body>
</html>
------------------------------------------------------------------
//carts.jsp
<%@page contentType="text/html;charset=ISO8859_1" %>
<html>
<jsp:useBean id="cart" scope="session" class="test.DummyCart"/>
<jsp:setProperty name="cart" property="*"/>
<%
cart.processRequest();
%>
<br>
<ol>
you have chosen these items:
<%
String []items=cart.getItems();
for(int i=0;i<items.length;i++)
{
%>
<li><%=items[i] %></li>
<%
}
%>
</ol>
<hr>
<%@include file="shopping.htm" %>
</html>
---------------------------------------------------------------------//DummyCart.java
package test;
import javax.servlet.http.*;
import java.util.Vector;
import java.util.Enumeration;
public class DummyCart
{
Vector v = new Vector();
String submit=null;
String item= null;
private void addItem(String name)
{
v.addElement(name);
}
private void removeItem(String name)
{
v.removeElement(name);
}
public void setItem(String s)
{
item=s;
}
public void setSubmit(String s)
{
submit=s;
}
public String[] getItems()
{
String []s=new String[v.size()];
v.Into(s);
return s;
}
public void processRequest()
{
if(submit==null)
addItem(item);
if(submit.equals("add"))
addItem(item);
else if (submit.equals("remove"))
removeItem(item);
reset();
}
private void reset()
{
submit=null;
item=null;
}
}
----------------------------------------------------------------------
上面是一個簡單的例子,功能都能實現,對網頁效果要求更漂亮些的可做一些修改。
7. JSP+JAVABEAN+SERVLET模式的購物車 如何清空購物車。。
把購物信息存入session中。清空購物車只管清空session中key對就的value.
8. Jsp寫的購物車代碼
這是其中的一段代碼,要項目的話加445899710
HttpSession session = request.getSession(false);
if(session==null){
dispatcher = request.getRequestDispatcher("show.jsp");
dispatcher.forward(request, response);
}
FoodBean foodBean = (FoodBean)session.getAttribute("FoodToAdd");
Map cart = (Map)session.getAttribute("cart");
if(cart==null){
cart = new HashMap();
session.setAttribute("cart", cart);
}
CartItemBean cartItem = (CartItemBean)cart.get(foodBean.getFoodID());
if(cartItem==null){
cart.put(foodBean.getFoodID(), new CartItemBean(foodBean,1));
}else{
cartItem.setNumber(cartItem.getNumber()+1);
}
9. jsp如何清除購物車的session數據
session.remove("name");