【问题标题】:Captcha in oracle adf projectoracle adf 项目中的验证码
【发布时间】:2023-04-02 15:59:02
【问题描述】:

我正在尝试使用验证码,如本例所示: http://www.oracle.com/technetwork/developer-tools/jdev/captcha-099103.html 它在 .jspx 页面或 .jsff 页面片段中工作正常,但我必须将验证码放在任务流的第一页上,然后......它没有更新! /* 我的意思是“无法读取图像”按钮不起作用 */ 我不知道为什么。有人可以帮忙吗?

实际上,我自己想出了如何做到这一点: 我们需要在我们的 bean 中绑定验证码图像和重置方法:

private RichImage captchaImage;
public void setCaptchaImage(RichImage captchaImage) {
    this.captchaImage = captchaImage;
}
public RichImage getCaptchaImage() {
    return captchaImage;
}
public void resetCaptcha(ActionEvent actionEvent) {
    captchaImage.setSource("/captchaservlet?rand=" + 
                           String.valueOf(Math.random()));          
    AdfFacesContext.getCurrentInstance().addPartialTarget(captchaImage.getParent());
}

所有,我不知道怎么做是添加参数到“/captchaservlet” 现在它工作正常:)

但出现了下一个问题:当从任务流中的第二个验证码返回此页面时,我需要刷新验证码图像。有什么方法是在页面返回时执行的吗?

【问题讨论】:

  • 您能否提供更多信息,例如您如何使用代码
  • 提供更多信息:)

标签: captcha oracle-adf


【解决方案1】:

Aaaaaaaaaaa,我发现了更优雅的解决方案:只需使用表达式构建器将验证码图像的来源设置为此方法即可:

public String getCaptchaSource() {
    return "/captchaservlet?rand=" + String.valueOf(Math.random());
}

当然,“刷新”按钮应设置为图像的部分触发器,如示例所示。 就是这样:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-02
    • 2021-07-06
    • 2022-01-16
    • 1970-01-01
    相关资源
    最近更新 更多