摘要: <body> <form action="/servletdemo/servlet/Request2" method="post"> 用户名:<input type="text" name="username"><br/> 密码:<input type="password" name="passwo 阅读全文
posted @ 2017-03-22 16:18 贱贱的小帅哥 阅读(107) 评论(0) 推荐(0)
摘要: 获取请求头: //获取头相关信息 private void test1(HttpServletRequest request) { //拿到指定符合的头信息 String header=request.getHeader("no-cache"); System.out.println("header 阅读全文
posted @ 2017-03-22 15:12 贱贱的小帅哥 阅读(693) 评论(0) 推荐(0)
摘要: request:封装了客户端所有的请求数据。 request --> 封装了客户端所有的请求数据!请求行请求头空行请求体(GET没体) 回忆一下http协议!请求协议中的数据都可以通过request对象来获取! * 获取常用信息 > 获取客户端IP,案例:封IP。request.getRemoteA 阅读全文
posted @ 2017-03-21 16:38 贱贱的小帅哥 阅读(452) 评论(0) 推荐(0)
摘要: //方法一 response.setStatus(302); response.setHeader("location", "/servletdemo/index.jsp"); //方法二 response.sendRedirect("/servletdemo/index.jsp"); 使用场景: 阅读全文
posted @ 2017-03-21 16:13 贱贱的小帅哥 阅读(128) 评论(0) 推荐(0)
摘要: response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); response.setDateHeader("expires", System.currentTimeMillis 阅读全文
posted @ 2017-03-20 18:16 贱贱的小帅哥 阅读(200) 评论(0) 推荐(0)
摘要: private void test1(HttpServletResponse response) throws IOException { response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;chars 阅读全文
posted @ 2017-03-20 17:31 贱贱的小帅哥 阅读(126) 评论(0) 推荐(0)
摘要: package day06; import java.awt.Color;import java.awt.Font;import java.awt.Graphics;import java.awt.image.BufferedImage;import java.io.IOException;impo 阅读全文
posted @ 2017-03-17 18:02 贱贱的小帅哥 阅读(139) 评论(0) 推荐(0)
摘要: public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String path = this.getServletContex 阅读全文
posted @ 2017-03-16 21:33 贱贱的小帅哥 阅读(112) 评论(0) 推荐(0)
摘要: response.setHeader("content-type", "text/html;charset=UTF-8"); String data="中国"; OutputStream out =response.getOutputStream(); out.write(data. getByte 阅读全文
posted @ 2017-03-16 21:00 贱贱的小帅哥 阅读(221) 评论(0) 推荐(0)
摘要: 如果读取资源文件的程序不是servlet的话,就只能通过类装载器去读取。配置文件不要太大,占用内存。 1、普通类: public class userUserDao { public void updata() throws IOException{ InputStream in=userUserD 阅读全文
posted @ 2017-03-08 20:24 贱贱的小帅哥 阅读(131) 评论(0) 推荐(0)