String regex = "
Pattern pa = Pattern.compile (regex, Pattern.DOTALL);
Matcher ma = pa.matcher (s);
List
while (ma.find ()) {
list.add (ma.group ());
}
return list;
}
public String save () {
NewsAction t = new NewsAction ();
String content = t.getHtmlContent ("http://www.baidu.com");
HttpServletRequest request = ServletActionContext.getRequest ();
String id = request.getParameter ("news_id");
n = newsService.findById (Integer.valueOf (id));
/ / add code to display pagination
/ / content = content.replaceAll ("(
) +?", "\ n" ;) ;/ / newline conversion
/ / content = content.replaceAll ("
. *? < ;/ p> "," ") ;/ / go picture comment
List
List
for (String s: a) {
news.add (s.replaceAll ("<. *?>", " " ) ) ; / / regex
n.setNews_Title (s); ;
String str = n.getNews_Title ();
Pattern p = Pattern.compile ("
Matcher m = p.matcher (str);
while (m.find ()) { ;
n.setNews_Title (m.group (1));
n.setNews_Id (n.getNews_Id () +1); ;
}
System.out.println (n.getNews_Title ());
System.out.println (n.getNews_Content ());
newsService.save (n);
}
return "main";
}
I do get all of the pages inside the value of a label , I just want
没有评论:
发表评论