20160324 javaweb 之request

package com.dzq.servlet; import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; @WebServlet("/CustomInfoServlet")
public class CustomInfoServlet extends HttpServlet {
private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String url=request.getRequestURL().toString();
System.out.println(url);
String uri=request.getRequestURI().toString();
System.out.println(uri);
String qStr=request.getQueryString();
System.out.println(qStr);
String ip=request.getRemoteAddr();
System.out.println(ip);
String method =request.getMethod();
System.out.println(method);
String name=request.getContextPath();
System.out.println(name);
} protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
} }





20160324 javaweb 之request的更多相关文章
- javaWeb中request请求转发和response重定向
1.访问资源 运用forward方法只能重定向到同一个Web应用程序中的一个资源. 而sendRedirect方法可以让你重定向到任何URL. 2.request.get Forward代码中的&q ...
- JavaWeb -pageContext/request/session/application
pageContext/request/session/application总结 一.范围差异 1. pageContext jsp页面容器 当前页面有效 2. request 请求对象 同一次请求 ...
- javaweb之request获取referer请求头实现防盗链
package test.request; import java.io.IOException; import javax.servlet.ServletException; import java ...
- javaweb入门-----request与response的作用
request对象和request对象的原理 1.request和response对象request对象和request对象的原理时由服务器创建的,我们来使用它们 2.request对象是来获取请求消 ...
- javaweb: request.getParameter()、request.setAttribute()与request.getAttribute()的作用 (转)
出处:https://blog.csdn.net/qq_41937388/article/details/87972914 1.request.getParameter()方法是获取通过类似post, ...
- Javaweb学习——request&response
request对象的作用 request是服务器对浏览器访问请求的封装 访问请求参数,通过getParameter()方法获取传递参数的值. 在进行转发请求时,需要把一些参数传递到转发后的页面进行处理 ...
- Java中Integer类的方法和request的setAttribute方法的使用与理解
一.Integer类的使用方法 Interger:整数类型 1.属性. static int MAX_VALUE:返回最大的整型数: static int MIN_VALUE:返回最小的整型数: st ...
- 超全面的JavaWeb笔记day10<Response&Request&路径&编码>
1.Response 2.Request 3.路径 4.编码 请求响应流程图 response 1.response概述 response是Servlet.service方法的一个参数,类型为java ...
- JavaWeb request对象常用操作
JavaWeb request对象常用操作 CreateTime--2018年6月1日16点47分 Author:Marydon 一.前提 import javax.servlet.http.Ht ...
随机推荐
- RegisterFunction z
#region SolidWorks Registration [ComRegisterFunctionAttribute] public static void RegisterFunction(T ...
- We're Hiring A Software Tester
测试人员的基本修养: 代码编写,不可或缺 乔布斯说:Design is not just what it looks like and feel like,design is how it works ...
- ubuntu 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
在用sudo apt-get install kmymoney2安装软件kmymoney2时,由于速度太慢,想换个软件源,直接关闭了终端,apt-get但进程没有结束,结果终端提示:"E: ...
- libmad和libmpg123解码mp3在安卓手机上的比较
libmad和libmpg123解码mp3在安卓手机上的比较1. libmad 选自 http://sourceforge.net/projects/mad libmad-0.15.1b.tar.g ...
- [一]初识SpringMVC
是什么? web开发框架 为什么用? 功能强大 怎么做? 1.导入jar包 2.配置web.xml <?xml version="1.0" encoding="UT ...
- smarty对网页性能的影响--开启opcache
在上一篇<smarty对网页性能的影响>中,默认没有开启opcache,于是我安装了一下zend opcache扩展,重新实验了一下,结果如下: 有smarty 用apache的ab命令进 ...
- 1、IIS常见的的问难及解决方法
配置IIS 7.5 出现的问题及解决办法: 1.问题: CS0016: 未能写入输出文件“c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Tempor ...
- Unity手游之路<六>游戏摇杆之Easy Touch 3教程
之前已经介绍过Unity自带的摇杆Joystick,它用起来很简单.但是它也存在很多局限,不能全部满足普通mmo手游的一些需求,例如:要能方便地更好素材:能指定在某个区域显示,或者只有在该区域触摸时才 ...
- ubuntu彻底卸载搜狗拼音输入法
ubuntu彻底卸载搜狗拼音输入法,ubuntu安装搜狗输入法后如果觉得搜狗不是很适合自己,那应该怎么样彻底的卸载搜狗输入法呢?下面我们就来一步步彻底卸载掉搜狗输入法... 方法/步骤 1 找到安装的 ...
- jquery ajax异步加载table的方法
//显示详细信息 function showInfo(actionId, type) { $.post("Sys_Ajax/Sys_EmployInfo.ashx", { &quo ...