zoukankan      html  css  js  c++  java
  • request传递参数

    当客户请求时,Servlet容器创建SrevletRequest对象(用于封装客户的请求信息),这个对象将被容器作为service()方法的参数之一传递给Srevlet,Servlet可以利用ServletRequest对象获取客户端请求数据。

    <form action="loing.do" method="post">
                    <div>
                        <span>用户名</span>
                        <div>
                            <input type="text" name="name" id="user" />
                        </div>
                        <span>密码</span>
                        <div>
                            <input type="password" name="password" id="pw" />
                        </div>
                    </div>
                        <div class="button">
                            <input type="submit" value=" 登 录" class="submit">
                        </div>
                </form>

    // 取得请求的参数
            String name = request.getParameter("name");
            String password = request.getParameter("password");

    //用request传递参数

    request.setAttribute("msg", "密码错误,请重新输入!");  

    request.setAttribute("msg", "用户" + name + "登录成功");

    <body>
        <c:if test="${not empty    requestScope.msg}"></c:if>
        <h1>${requestScope.msg}</h1>  获取参数。
    </body>

  • 相关阅读:
    jQuery scroll事件
    jquery offset() 与position()方法的区别
    股票基本知识
    swfObject 使用说明
    javascript和swf在网页中交互的一些总结
    TCP 同步传输:客户端发送,服务器段接收
    读取Excel
    sql 执行顺序
    支付宝及时到帐接口
    Ajax中get提交和post提交的区别
  • 原文地址:https://www.cnblogs.com/TangGe520/p/8617265.html
Copyright © 2011-2022 走看看