zoukankan      html  css  js  c++  java
  • request.getAttribute( "result");和request.setAttribute("result",username);

    request.setAttribute("result",username);
    在request对象中加入名为result的属性并附值为username,因为request对象是可以更改的,你可以
    在同一个请求中象这样访问这个属性。

    虽然类似session,但与session是有所区别的,request.setAttribute设置的属性只能在当前
    request只使用,比如你在Action中设置result属性,需要到jsp页面中读取:
    request.setAttribute("result",username);
    requests.getRequestDispatcher("result.jsp").forward(request, response);
    jsp页面获取该值:
    request.getAttribute( "result");

    因为一同将当前action的request与response对象都发送过来,相当于直接操作自身页面。


    request.setAttribute("result",username);
    request.getRequestDispatcher("result.jsp").forward(request,response);
    requset.getAttribute("result");

    ---- 动动手指关注我!或许下次你又能在我这里找到你需要的答案!ZZZZW与你一起学习,一起进步!
  • 相关阅读:
    加分二叉树
    香甜的黄油 Sweet Butter
    09.22今日暂时停更题解
    能量项链
    转圈游戏
    字串变换
    关押罪犯
    选择客栈
    神经网络
    未整理算法的总结
  • 原文地址:https://www.cnblogs.com/zzzzw/p/4849731.html
Copyright © 2011-2022 走看看