【问题标题】:Image is not displaying for simple-captcha in GrailsGrails 中的简单验证码不显示图像
【发布时间】:2016-04-16 16:51:48
【问题描述】:

图像未针对 Grails simple-captcha 插件显示。 在打印控制器中的 params.captcha 时打印 null 值。

可能的解决方案是什么?如果有人提到在 Grails 2.3.3 中集成 simple-captcha 插件的步骤,我将不胜感激。我的 GSP 页面代码是:

<g:form controller="user" action="register">
    <g:textField name="email" placeholder="email"/><br>
    <g:passwordField name="password" placeholder="password"/><br>
    <img src="${createLink(controller: 'user', action: 'register')}"/>
    <label for="captcha">Type the letters above in the box below:</label>
    <g:textField name="captcha"/>
    <g:actionSubmit value="register" action="register" /><br>
</g:form>

【问题讨论】:

  • 找不到问题,但在控制器中尝试打印所有参数println params 以查看是否存在。也许你有错字或……
  • 加上图片src肯定错了

标签: grails grails-plugin


【解决方案1】:

您使用了错误的网址。改变

<img src="${createLink(controller: 'user', action: 'register')}"/>

<img src="${createLink(controller: 'simpleCaptcha', action: 'captcha')}"/>

现在,您的图片将显示出来,您可以输入验证码并提交表单。在user 控制器的register 操作中,您现在将看到params.captcha

【讨论】:

    猜你喜欢
    • 2018-03-14
    • 1970-01-01
    • 1970-01-01
    • 2013-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多