public static String getIpAddr(HttpServletRequest request) { String ipAddress = null; ipAddress = request.getHeader("x-forwarded-for"); if (ipAddress ...
分类:
编程语言 时间:
2016-12-12 19:02:46
阅读次数:
132
private Map<String, String> getHeadersInfo(HttpServletRequest request) { Map<String, String> map = new HashMap<String, String>(); Enumeration headerNa ...
分类:
其他好文 时间:
2016-12-10 22:19:11
阅读次数:
266
1、什么是web资源: HttpServletRequest,HttpSession,ServletContext等原生的Servlet API. 2、为什么要访问web资源? B/S应用的Controller 中必然需要访问web资源:如域对象中读写属性,读取Cookie,获取realPath.. ...
分类:
Web程序 时间:
2016-12-10 13:28:24
阅读次数:
177
做WEB项目的时候,别人拷贝了一份源码给你导入myeclipse结果发现一堆报错 HttpServletRequest 一排红色波浪线..... 这个原因主要是没有tomcat下的一个jar包 servlet-api.jar 想直接从其他项目拷贝过来 不科学 所以可以给myeclipse添加运行环境 ...
分类:
Web程序 时间:
2016-12-05 20:08:51
阅读次数:
202
一、HttpServletResponse 里面有很多常量代表状态吗404等 1、响应行 HTTP/1.1 200 OK setStatus(int sc) 设置响应状态码(200) 2、响应头 sendRedirect(String location) // 请求重定向 setHeader(Str ...
分类:
Web程序 时间:
2016-12-05 19:48:28
阅读次数:
476
简介:Struts2是一个轻量级的典型的MVC框架。 工作流程: 1、客户端请求一个HttpServletRequest的请求,如在浏览器中输入http://localhost: 8080/bookcode/Reg.action就是提交一个(HttpServletRequest)请求。 2、这个请求 ...
分类:
其他好文 时间:
2016-12-05 16:48:04
阅读次数:
244
JSP中一共预先定义了9个这样的对象,分别为:request、response、session、application、out、pagecontext、config、page、exception 1、request对象javax.servlet.http.HttpServletRequest req ...
分类:
Web程序 时间:
2016-12-03 12:40:15
阅读次数:
222
public class MyController extends MultiActionController { // 新增 方法修饰符要是public public ModelAndView add(HttpServletRequest request, HttpServletResponse ...
分类:
编程语言 时间:
2016-12-02 11:47:19
阅读次数:
148
public class BaseServlet extends HttpServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletExcepti ...
分类:
Web程序 时间:
2016-12-01 07:37:07
阅读次数:
207
一简介如题所示,有时候我们需要在一个请求到达Controller之前能够截获其请求,并且根据其具体情况对HttpServletRequest中的参数进行过滤或者修改。这时,有的同学可能会想:我们是否可以在一个Filter中将HttpServletRequest里的所有参数都取出来分别进行过滤然后再放回到该Htt..
分类:
移动开发 时间:
2016-11-29 15:15:53
阅读次数:
575