Java 如何从html中删除jsessionid(从jsp转换)

Java 如何从html中删除jsessionid(从jsp转换),java,http,jsp,get,apache-httpclient-4.x,Java,Http,Jsp,Get,Apache Httpclient 4.x,我有一个(struts 2)操作,它在被调用时重定向到jsp。我正在尝试使用HttpClient将此jsp保存为html。这可以很好地工作,除了一件事,服务器会在html中存在其他操作的地方追加jsessionid=RandomText 如何从最终html中删除jsessionid? 来自呈现html的示例: <a href='/wah/destinationSEO.action;jsessionid=123ASDGA123?idDestination=22'> 使用Java并将内

我有一个(struts 2)操作,它在被调用时重定向到jsp。我正在尝试使用HttpClient将此jsp保存为html。这可以很好地工作,除了一件事,服务器会在html中存在其他操作的地方追加
jsessionid=RandomText

如何从最终html中删除jsessionid?

来自呈现html的示例:

<a href='/wah/destinationSEO.action;jsessionid=123ASDGA123?idDestination=22'>

使用Java并将内容中的jsessionid=up替换为?。

按照Amingh的建议,正则表达式完成了这项任务!我希望我能在客户/请求中指定一些内容,但是哦,好吧

对于其他人来说,这就是它的作用:

    // code as written above
    Pattern pattern = Pattern.compile(";jsessionid(=\\w+)");
    Matcher m = pattern.matcher(content);

    content = m.replaceAll("");

    Files.write(content, html, Charsets.UTF_8);
这两个链接非常有用:


相反,我可以在请求或客户端中指定一些内容吗?另外,你能帮我解释一下这个表达吗?
    // code as written above
    Pattern pattern = Pattern.compile(";jsessionid(=\\w+)");
    Matcher m = pattern.matcher(content);

    content = m.replaceAll("");

    Files.write(content, html, Charsets.UTF_8);