帮忙看看这个问题,JSP错误说:The value for the useBean class attribute iteam.ShoppingCart is invalid.
<%@pagelanguage="java"contentType="text/html;charset=utf-8"pageEncoding="utf-8"%><%@i...
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ include file="common.jsp" %>
<jsp:useBean id="cart" class="iteam.ShoppingCart" scope="session"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<%
String delete=request.getParameter("delete");
String update=request.getParameter("update");
String clear=request.getParameter("clear");
String ISBN=request.getParameter("ISBN");
int qty=0;
int count=0;
if(ISBN!=null)
{
cart.add(ISBN);
}
if(clear!=null)
{
cart.clear();
}
if(delete!=null)
{
cart.remove(delete);
}
if(update!=null)
{
count=cart.getNumberOfItems();
for(int i=1;i<count;i++)
{
// ISBN=request.getParameter("no"+1);
qty=Integer.parseInt(request.getParameter("qty"+i));
cart.setItem(ISBN,qty);
}
}
if(cart.getNumberOfItems()==0)
{
out.println("您的购物车为空!<input type=button name=Goback value=继续购物 onclick=javascript:windows.location='goods.html'>");
}else
{
%>
<form name="form1" method="post" action="add.jsp">
<table width="700" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#2A9FFF" background="image/bg-0002.gif">
<tr>
<td width="99"><div align="center">商品名称</div></td>
<td width="111"><div align="center">商品类别</div></td>
<td width="73"><div align="center">单价</div></td>
<td width="57"><div align="center">数量</div></td>
<td width="57"><div align="center">总价</div></td>
<td width="171"><div align="center">会员信息管理</div></td>
</tr>
<%
int i=0;
while(cart.getItems().hasNext())
{
ShoppingCartItem item=(ShoppingCartItem)cart.getItems().next();
i++;
%>
<tr>
<td height="35"><div align="center"><%=item.ISBN %></div></td>
<td><div align="center"><%=item.category %></div></td>
<td><div align="center"><%=item.price %></div></td>
<td><div align="center"><input name="qut<%=i %>" type="text" value=<%=item.quantity %>>
<input name="no<%=i %>" type="hidden"> </div></td>
<td><div align="center"><%=item.price*item.quantity %></div></td>
<td><div align="center">
<a href="shoppingcar.jsp?delete=<%= item.ISBN %>">删除</a></div>
</td>
</tr>
</table>
<%
}%>
<p align="center">
合计:<font color =red><%=cart.getTotal() %></font>元<br/><br/>
<input type="button" name="back" value="继续购物" onclick=javascript:window.location='goods.html'>
<input type="button" value="去收银台结帐" onclick=javascript:window.location=''>
<input type="submit" name="update" id="button" value="更新">
<input type="submit" name="clear" id="button" value="清空购物车"></p>
</form>
<%} %>
</body>
</html> 展开
pageEncoding="utf-8"%>
<%@ include file="common.jsp" %>
<jsp:useBean id="cart" class="iteam.ShoppingCart" scope="session"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<%
String delete=request.getParameter("delete");
String update=request.getParameter("update");
String clear=request.getParameter("clear");
String ISBN=request.getParameter("ISBN");
int qty=0;
int count=0;
if(ISBN!=null)
{
cart.add(ISBN);
}
if(clear!=null)
{
cart.clear();
}
if(delete!=null)
{
cart.remove(delete);
}
if(update!=null)
{
count=cart.getNumberOfItems();
for(int i=1;i<count;i++)
{
// ISBN=request.getParameter("no"+1);
qty=Integer.parseInt(request.getParameter("qty"+i));
cart.setItem(ISBN,qty);
}
}
if(cart.getNumberOfItems()==0)
{
out.println("您的购物车为空!<input type=button name=Goback value=继续购物 onclick=javascript:windows.location='goods.html'>");
}else
{
%>
<form name="form1" method="post" action="add.jsp">
<table width="700" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#2A9FFF" background="image/bg-0002.gif">
<tr>
<td width="99"><div align="center">商品名称</div></td>
<td width="111"><div align="center">商品类别</div></td>
<td width="73"><div align="center">单价</div></td>
<td width="57"><div align="center">数量</div></td>
<td width="57"><div align="center">总价</div></td>
<td width="171"><div align="center">会员信息管理</div></td>
</tr>
<%
int i=0;
while(cart.getItems().hasNext())
{
ShoppingCartItem item=(ShoppingCartItem)cart.getItems().next();
i++;
%>
<tr>
<td height="35"><div align="center"><%=item.ISBN %></div></td>
<td><div align="center"><%=item.category %></div></td>
<td><div align="center"><%=item.price %></div></td>
<td><div align="center"><input name="qut<%=i %>" type="text" value=<%=item.quantity %>>
<input name="no<%=i %>" type="hidden"> </div></td>
<td><div align="center"><%=item.price*item.quantity %></div></td>
<td><div align="center">
<a href="shoppingcar.jsp?delete=<%= item.ISBN %>">删除</a></div>
</td>
</tr>
</table>
<%
}%>
<p align="center">
合计:<font color =red><%=cart.getTotal() %></font>元<br/><br/>
<input type="button" name="back" value="继续购物" onclick=javascript:window.location='goods.html'>
<input type="button" value="去收银台结帐" onclick=javascript:window.location=''>
<input type="submit" name="update" id="button" value="更新">
<input type="submit" name="clear" id="button" value="清空购物车"></p>
</form>
<%} %>
</body>
</html> 展开
2011-06-30
展开全部
是不是取值的时候少了这样的表达式
<jsp:useBean id="cd " class=" " ></jsp:useBean>
<c:forEach var="c" items="${cd.acselect}">
</c:forach>
<jsp:useBean id="cd " class=" " ></jsp:useBean>
<c:forEach var="c" items="${cd.acselect}">
</c:forach>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
给你的dbBean在类里写上setter和getter方法试试.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我也有这种问题,不知道是怎么个情况
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询