This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1、客户端发出请求; | |
| 2、DispatcherServlet 获取请求; | |
| 3、DispatcherServlet 查询 HandlerMapping,将请求的URL映射到一个控制器对象Controller, | |
| 并将请求分发给这个 Controller; | |
| 4、Controller 根据设计的业务逻辑处理请求; | |
| 5、完成业务逻辑的处理后,Controller 返回一个ModelAndView 给 DispatcherServlet ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Pattern p = Pattern.compile("@\\w+\\s"); | |
| String str = "@tom @jerry @rose 这是我的电子邮件,给我发邮件哦[email protected]"; | |
| Matcher m = p.matcher(str); | |
| while(m.find()) { | |
| System.out.println(m.group()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| URL url = new URL("http://www.baidu.com"); | |
| URLConnection conn =url.openConnection(); | |
| InputStream stream = conn.getInputStream(); | |
| //字符流 | |
| BufferedReader reader = new BufferedReader(new InputStreamReader(stream,"UTF-8")); | |
| String str = null; | |
| StringBuffer sb = new StringBuffer(); | |
| while((str=reader.readLine())!=null){ | |
| sb.append(str); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| URL url = new URL("http://www.kaishengit.com/images/2013.jpg"); | |
| URLConnection conn =url.openConnection(); | |
| InputStream stream = conn.getInputStream(); | |
| File file = new File("F:/tupian.jpg"); | |
| OutputStream out = new FileOutputStream(file); | |
| BufferedInputStream bis = new BufferedInputStream(stream); | |
| BufferedOutputStream bos = new BufferedOutputStream(out); |
OlderNewer