zoukankan      html  css  js  c++  java
  • 9.30 servlet学习

    9.30

    1.客户端访问服务器路径 : localhost:8080/映射的项目名字
    2.服务端响应客户端: servletResponse.getWrite().write("hello,六道");
    这里代码我理解为,你要响应要获取一支笔getWrite,操作对象得到了一只笔,拿到笔就可以
    写东西喽,write("content");
    3.服务端响应客户端中文乱码解决方案代码:
    servletResponse.setContentType("text/html;charset=UTF-8");
    见名知意把 , 响应的时候set设置响应的内容类型contenType 是文本的text,最终的浏览器响应的形式是html的,jsp也是html嘛 不过是升级的html,jsp还可以写java代码
    字符串的类型设置charset是UTF-8
    4.服务端接收客户端请求过来的参数
    String id = servletRsquest.getParaeter("id");
    了解key:value 键值对的存储特点,拿到key,就能取到key对应的value值

  • 相关阅读:
    [HNOI2008] Cards
    loj #136
    a problem
    dp * 3
    STL
    套题1
    luogu 4211
    loj #2319
    loj #2316
    luogu 1144
  • 原文地址:https://www.cnblogs.com/wangdayang/p/13994216.html
Copyright © 2011-2022 走看看