【问题标题】:jericho Html parser error in jsp pagejsp页面中的jericho Html解析器错误
【发布时间】:2013-02-01 04:38:55
【问题描述】:

我把代码写成

String sourceUrlString="http://some url";
Source source=new Source(new URL(sourceUrlString));
Element INFORM = source.getElementById("main").getAllElementsByClass("game").get(i-1);
String INFORM = INFORM.replaceAll("\\s","");   //shows error here
sendResponse(resp,+INFORM);

现在我想要 text 从 Element INFORM 获取是忽略空白我该怎么做?上面提到String INFORM显示错误重复的局部变量INFORM);

例如

Element INFORM 获取的文本是“我的名字是 satish” 但它必须发送响应为

“我的名字”

【问题讨论】:

    标签: java html jsp jakarta-ee html-parsing


    【解决方案1】:

    您的名字 INFORM 被使用了两次 - 这是不可能的!

    String sourceUrlString = "http://some url";
    Source source = new Source(new URL(sourceUrlString));
    Element INFORM = source.getElementById("main").getAllElementsByClass("game").get(i-1);
    String response = INFORM.replaceAll("\\s","");   // ! Use another name here !
    sendResponse(resp, respone); // or use '+' - not shure if 1 or 2 args
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-08
      • 2012-08-01
      • 2012-01-31
      • 2012-01-03
      • 2012-09-20
      • 2018-06-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多