查询数据,从链接地址中爬取文章内容
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub //response.getWriter().append("Served at: ").append(request.getContextPath()); int pageNum=1; int pageSize=100; for(pageNum=1;pageNum<101;pageNum++) { try { int page1= (pageNum-1)*pageSize; Map<Integer,String> map1 = ManageMySQL.getPageData(page1,pageSize); for(Integer key : map1.keySet()) { System.out.println(key+" "+map1.get(key)); String context1 = getContentByURL(map1.get(key)).replace(" ", ""); ManageMySQL.updateContext(key, context1); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }