2016-04-15 62 views
2

图像不显示为Grails simple-captcha插件。 打印控制器空值时打印params.captcha。图像未在简体验证码中显示在Grails中

什么可能是解决方案?如果有人提到将simple-captcha插件集成到Grails 2.3.3中,我会很感激。我的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> 
+0

找不到问题,但在控制器中尝试打印所有参数'println params',看它是否在那里。也许你有一个错字或...... –

+0

加上图像src是**肯定错了**​​ –

回答

3

您正在使用错误的URL。更改

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

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

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

+1

谢谢,现在它的工作。 – Novice