JAVA:无法从Captcha复制图像

时间:2012-11-23 11:52:37

标签: java captcha jsoup

我正在尝试从此网站复制验证码图片: http://processual.trf1.jus.br/consultaProcessual/numeroProcesso.php?secao=PI 并尝试显示在我的页面中。

支持bean:CaptchaBean.java

 private String imagem;

 public void getImageFromTRF() {
        Document document = Jsoup.connect("http://processual.trf1.jus.br/consultaProcessual/numeroProcesso.php?secao=PI")
                .userAgent("Mozilla/5.0 (Windows NT 6.0) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5")
                .get();
        Element imagemCaptcha = document.getElementById("image_captcha");
        Element codigoCaptcha = document.getElementById("trf1_captcha_id");
        imagem = imagemCaptcha.attr("abs:src");
 }

页面:

<h:graphicImage value="#{captchaBean.imagem}"/>
发生了奇怪的事。页面始终显示没有字母和数字CAPTCHA。

0 个答案:

没有答案