Redirecting instead of Forwarding ---core servlets and jsps 2nd

  • forward behavior:
    1. Control is transferred entirely on server. No network traffic is involved.
    2. The user does not see the address of the destination JSP page and pages can be placed in web-inf to prevent the user from accessing them without going through servlet that sets up the data. This is beneficial if the JSP page makes sense only in the context of servlet-generated data.
  • sendRedirect behavior:
    1. Control is transferred by sending the client a 302 status code and a Location on response header. Transfer requires an additional network round trip.
    2. The user see the address of the destination page and can bookmark it and access it independently. This is beneficial if the JSP is designed to use default values whendata is missing. eg, this approach would be used when redisplaying an incomplete HTML form or summarizing the contents of a shopping cart. In both cases, previously create data would be extracted from the user's session, so the JSP page makes sense even for requests that do not involve the servlet.
      • 0
        点赞
      • 0
        收藏
        觉得还不错? 一键收藏
      • 0
        评论
      评论
      添加红包

      请填写红包祝福语或标题

      红包个数最小为10个

      红包金额最低5元

      当前余额3.43前往充值 >
      需支付:10.00
      成就一亿技术人!
      领取后你会自动成为博主和红包主的粉丝 规则
      hope_wisdom
      发出的红包
      实付
      使用余额支付
      点击重新获取
      扫码支付
      钱包余额 0

      抵扣说明:

      1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
      2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

      余额充值