2013年10月1日星期二

How to obtain <p id="nv"> next <a> label the contents inside

public List getNewsurl (String s) {
String regex = "";

Pattern pa = Pattern.compile (regex, Pattern.DOTALL);
Matcher ma = pa.matcher (s);
List list = new ArrayList ();
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 a = t.getNewsurl (content);
List news = new ArrayList ();
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

down , label value , how does the change, thank < br> ------ Solution ----------------------------------------- ---


var v=document.getElementById("nv").getElementsByTagName("a");
alert(v);

------ Solution ------------------------------- -------------
$ ("# nv a"). val () or $ ("# nv"). find ("a"). val ( )

没有评论:

发表评论