servlet获取不到jsp页面的数据

jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>



    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/common.css">
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/register.css">
</head>

<script src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script src="<%=request.getContextPath()%>/js/register.js"></script>


<body>
    <div class="top">
        <div class="banner">
            <div class="icon">
                <img src="<%=request.getContextPath()%>/img/otherimg/1.jpg" />
            </div>
            <div class="title">
                <span>欢迎注册广购书页!尽享多重优惠服务</span>
            </div>
            <div class="dologin">
                <span>已有账号<a href="#">请登陆</a></span>
            </div>
        </div>
    </div>

    <div class="clear"></div>

    <div class="registerform banner">
        <form action="ReServlet" method="post">
            <div class="emailbox">
                <div class="email">
                    <span>邮    箱:</span>
                    <input type="text" name="email"/>
                </div>
                <span class="alertSpan">email地址不能为空</span>
            </div>

            <div class="pwdbox">
                <div class="pwd">
                    <span>设置密码:</span>
                    <input type="text" name="pwd"/>
                </div>
                <span class="alertSpan">您的密码可以由大小写英文字母、数字组成,长度6-16</span>
            </div>

            <div class="repwdbox">
                <div class="repwd">
                    <span>确认密码:</span>
                    <input type="text" name="repwd"/>
                </div>
                <span class="alertSpan">您输入的密码不一样,请重新输入!</span>
            </div>

            <div class="telbox">
                <div class="tel">
                    <span>手机号码:</span>
                    <input type="text" name="tel"/>
                </div>
                <span class="alertSpan">温馨提示:填写手机号码后将收到我们的促销短信、发货通知!</span>
            </div>

            <div class="codebox">
                <div class="code">
                    <span>验证码:</span>
                    <input type="text" name="code" style="width:130px"/>
                </div>
                <div class="codedetail">
                    <img alt="占位" src="<%=request.getContextPath()%>/img/otherimg/1.jpg"/>
                    <a href="#">换一张</a>
                </div>
            </div>

            <div class="clear"></div>

            <div class="submitform">
                <input type="submit" value="立即注册"/>
            </div>
        </form>
    </div>
</body>

servlet:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;utf-8");

    //System.out.println("shenmegui");

    String email = request.getParameter("email");
    System.out.println(email);

    response.getWriter().write("xxx");
}

3个回答

请求到达servlet了吗

请先看一下你的from表单提交的路径,《form action="ReServlet" method="post"》 ReServlet这是啥?路径这么写么

1.servlet 映射路径是否为:ReServlet
2.method="post" 提交的是doPost 你在doGet里面写的函数体。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!