(一) request

为什么80%的码农都做不了架构师?>>>   hot3.png

  主要方法如下,

<%@ page language="java" import="java.util.*" contentType="text/html;  charset=GB2312"%>



request主要方法的使用



request主要方法的调用示例:

<%
request.setAttribute("attr", "Hello!");
out.print("attr属性值为:"+request.getAttribute("attr")+"
");
out.print("上下文的路径为:"+request.getContextPath()+"
");
out.print("Cookies:"+request.getCookies()+"
");
out.print("Host:"+request.getHeader("Host")+"
");
out.print("ServerName: "+request.getServerName()+"
");
out.print("ServerPort: "+request.getServerPort()+"
");
out.print("RemoteAddr: "+request.getRemoteAddr()+"
");
request.removeAttribute("attr");
out.print("属性移除操作之后attr属性的值为: "+request.getAttribute("attr")+"
");
%>



运行结果:

(一) request_第1张图片

转载于:https://my.oschina.net/garyun/blog/602897

你可能感兴趣的:((一) request)