zoukankan      html  css  js  c++  java
  • Servlet基本概念记录(随笔...不完全...)

    1.HTTP的请求方法种类

      GET,POST,HEAD,PUT,DELETE,TARCE,OPTIONS,CONNECT

    2.常用到的MIME类型

      text/html , application/pdf , video/quicktime , application/java , image/jpeg , application/jar , application/x-zip , application/octet-stream

      可通过 HttpServletResponse实例的 setContentType(String contentType)设置

       例如:response.setContentType("application/jar");

    3.response对象中的 sendRedirect(String location)方法中location值

      a.绝对路径 : www.baidu.com

      b.相对路径:

        ①/开头   /result/index 重定向到webapp下的 /result/index下

        ②不以/开头 假设客户端原来的请求地址是 localhost:8080/getUser/userInfo/modifyInfo.jsp ,此时location为 index.jsp的话,那么重定向后的地址是:localhost:8080/getUser/userInfo/index.jsp

    4.如果通过response写出文件/text后 ,不可以再调用sendRedirect方法; 二者择其一

  • 相关阅读:
    day_5.25py
    day_5.24py
    day_5.22 py
    numpy模块 03
    requests 模块例题示范
    logging模块
    typing 模块
    hashlib模块和hmac模块
    random模块
    time和datetime模块
  • 原文地址:https://www.cnblogs.com/lzzRye/p/10463080.html
Copyright © 2011-2022 走看看