当前位置: 代码迷 >> J2EE >> 表单内容提交失败的原因
  详细解决方案

表单内容提交失败的原因

热度:87   发布时间:2016-04-22 01:26:10.0
求教:表单内容提交失败的原因
疑问:表单中的内容提交后,接收不到。
问题详细描述:
1、我在viewcart.jsp里装载了updatecat.jsp页面,updatecat.jsp用来更新购物车的数量业务逻辑;
2、viewcart.jsp是展示购物车中的内容,修改数量后,点击提交,将表单中的数据传到updatecat.jsp中进行更新。
3、
在updatecart.jsp中用request接收到的参数只有提交按钮的信息(<input type="submit" name="submit" value="保存修改" />),没有我想要的信息(<input type="text" name="${dish.dishid}" value="${item.quantity}" />)
4、貌似错误很明显,因为我用myeclipse自带的tomcat时还可以运行,到改为tomcat6时,就出错了,或许和这个没关系,但总之,我很无语呀……。
页面设置如下:
购物车展示页面:viewcart.jsp

HTML code
<%@ page language="java" contentType="text/html; charset=GBK"    import="java.util.Map,java.util.Set,j2ee.domain.CartItemBean,j2ee.domain.Cart,j2ee.domain.Dish" pageEncoding="GBK"%><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- 获取session中的cart --><html><head><meta http-equiv="Content-Type" content="text/html; charset=GBK"><title>显示购物车</title></head><body><%-- 加载更新数量和删除菜单项的JSP页面 --%><jsp:include page="updatecart.jsp" flush="false"/><jsp:include page="delitemfromcart.jsp" flush="false"/><form name="viewform" action="viewcart.jsp" method="post">            <table width="100%" border="0" align="CENTER" cellpadding="2"                cellspacing="1" bgcolor="#c0c0c0">                <tr bgcolor="#dadada">                    <td height="22" width="36">                        <div align="CENTER">                            <font color="#000000">编号</font>                        </div>                    </td>                    <td width="100" height="22">                        <div align="CENTER">                            <font color="#000000">菜名</font>                        </div>                    </td>                    <td height="22" width="36">                        <div align="CENTER">                            <font color="#000000">单价</font>                        </div>                    </td>                    <td height="22" width="36">                        <div align="CENTER">                            <font color="#000000">数量</font>                        </div>                    </td>                    <td width="36" height="22">                        <div align="CENTER">                            <font color="#000000">金额</font>                        </div>                    </td>                    <td width="36" height="22">                        <div align="CENTER">                            <font color="#000000">操作</font>                        </div>                    </td>                </tr><c:set var="cart" value="${sessionScope.CART}" scope="session"/><c:if test="${cart!=null}"><c:set var="totalprice" value="${0.0+0.0}"/>            <c:forEach var="entry" items="${cart}">                                            <c:set var="item" value="${entry.value}"/>                        <c:set var="totalprice" value="${totalprice+item.totalprice}"/>                        <c:set var="dish" value="${item.dish}"/>                        <tr bgcolor="#ffffff">                            <td width="36" align="center" height="22">                                <font color="#000000">${dish.dishid}</font>                            </td>                            <td width="100" height="22">                                <font color="#000000">${dish.dishname}</font>                                                            </td>                            <td width="36" align="center" height="22">                                <font color="#000000">${dish.nowprice}</font>                            </td>                            <td width="36" class="hh" align="center" height="22">                                <input type="text" name="${dish.dishid}" value="${item.quantity}" />                            </td>                            <td width="36" class="bb" align="center" height="22">                                <font color="#000000">${item.totalprice}</font>                            </td>                            <td width="36" class="bb" align="center" height="22">                                <font color="#000000"><a href="viewcart.jsp?delid=${dish.dishid}">删除</a>                                </font>                            </td>                        </tr>                    </c:forEach>                                    <tr>                    <td width="36" class="bb" align="center" height="22">                        <font color="#000000">总价</font>                    </td>                    <td width="36" class="bb" align="center" height="22">                        <font color="#000000"><c:out value="${totalprice}"/></font>                    </td>                </tr>                 </c:if>                             </table>                        <input type="submit" name="submit" value="保存修改" />            <a href="show.jsp">继续购物</a>            <a href="settle?total=${totalprice}">结算</a>                        </form></body></html>
  相关解决方案