struts 中显示层向action传值的问题
<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
</head>
<html:form action="/orderitem">
<body>
<c:forEach items="${sessionScope['books.display.list']}" var="book" begin="8" end="14">
<img src="${book.image}"/><br/>
编号${book.bookid}<br/>
书名${book.name} <br/>
价格${book.price} <br/>
销售价格${book.salebook} <br/>
书的概要${book.descript} <br/>
书的内容${book.contents}<br/>
上架日期${book.saledate} <br/>
打折${book.salecount} <br/>
<html:hidden property="method" value="save"/>
<html:hidden property="id" value="${book.bookid}"/>
<form id="form1" name="form1" method="post" action="orderitem">
<label>
所购数量<input type="text" name="textfield" id="textfield" />??????????????????????
</label>
</form> <a href="orderitem.do?method=save&id=${book.bookid}">购物车<br/>
</c:forEach>
<ul><li><br></li></ul>
</body>
</html:form>
、、、、、、、、、、、、、、、、、、、、、、、、、、、、
public ActionForward save(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HttpSession session=request.getSession();
Shopcart shopcart=new Shopcart();
Orders orders=new Orders();
Bookmsg bookmsg=new Bookmsg();
String id=request.getParameter("id");
String count=request.getParameter("textfield");??????????调用save函数后,为何得不到text中的数值啊,怎样可以获取呢
bookmsg= bookmsgManager.GetBookmsg(id);
orderid++;
shopcart.setOrderid(orderid);
orders.setOrdersid(orderid);
shopcart.setOrders(orders);
number+=new Integer(count);
shopcart.setCount(new Integer(count));
sum+=new Double(bookmsg.getPrice())*new Integer(count);
shopcart.setPrice(new Double(bookmsg.getPrice()));
shopcart.setOrderid(orderid);
bookmsg.setBookid(new Integer(id));
shopcart.setBookmsg(bookmsg);
shopcart.setBooksid(new Integer(id));
shopcart.setShopcartid(i);
shopcartManager.save(shopcart);
map.put(i,shopcart);
i++;
session.setAttribute("shopcart.display.list", map);
session.setAttribute("number.display.list",number);
session.setAttribute("sum.display.list",sum);
return mapping.findForward("success");
}
------解决方案--------------------1.javascript
2.用struts的标签 在form里面获得
------解决方案--------------------<form id="form1" name="form1" method="post" action="orderitem.do?method=save&id=${book.bookid}">
<label>
所购数量 <input type="text" name="textfield" id="textfield" />??????????????????????
</label>
</form> <a href="#" onclick="javascript:from1.submit();">购物车 <br/>