Grails 如何替换gsp中的编码?

Grails 如何替换gsp中的编码?,grails,gsp,cleditor,Grails,Gsp,Cleditor,如何替换finePrint中的编码 我称之为“精细打印”的大文本区域。。。 这是我的问题…我很困惑。。 当我在gsp上用${name}填充HMTL的编码。。 像这样 看箭头…下面有一个按钮提交finePrint…当我点击它。。。 我用“Bobby”填充的“Your Name”的g:text字段。它将在精细打印中替换为${Name} 这是我的gsp编码,我将其填入finePrint <table align="center" > <tbody>

如何替换finePrint中的编码

我称之为“精细打印”的大文本区域。。。 这是我的问题…我很困惑。。 当我在gsp上用${name}填充HMTL的编码。。 像这样

看箭头…下面有一个按钮提交finePrint…当我点击它。。。 我用“Bobby”填充的“Your Name”的g:text字段。它将在精细打印中替换为${Name}

这是我的gsp编码,我将其填入finePrint

<table align="center" >

            <tbody>
            <tr style="border-spacing:0!important;border-collapse:collapse!important;color:#666666;background-color:#F8F8F8" align="center">
                <td style="padding:35px 75px 60px 75px;background-color:#fafafa;">
                    <table style="border-spacing:0!important;border-collapse:collapse!important;color:#666666;" width="80%">
                    <tbody>
                    <tr>
                        <td>
                            <p align="center"><img alt="Tempo AI" border="0"/></p>
                            <h1 style="font-family:Arial,Helvetica,sans-serif;color:#ee710b;font-size:30px;font-weight:normal;width:450px">${name}, you requested to reset your Password</h1>
                            <p style="padding:0;margin:0 0 15px 0;">To reset your password, just click the link below.</p>
                            <p style="padding:0;margin:0 0 15px 0;"><a href="" style="color:#44b1d9;">Reset Password</a></p>
                            <p style="padding:0;margin:0;">Best,</p>
                            <p style="padding:0;margin:0;color:#bcbcbc;font-size:20px;">Tempo Team</p>                  
                        </td>
                    </tr>
                    </tbody>
                    </table>
                </td>
            </tr>

            <tr style="font-family:Arial, Helvetica, sans-serif;padding-top:15px;" align="center" >
                <td style="font-family:Arial, Helvetica, sans-serif;padding-top:15px;" align="center">
                    <p style="margin-top:0;margin-bottom:10px;">
                        <a href="http://www.facebook.com" style="text-decoration:none;">
                            <img alt="Facebook"  border="0"/>
                        </a>
                         &nbsp;&nbsp;&nbsp;

                        <a href="http://www.twitter.com" style="text-decoration:none;">
                            <img alt="Twitter" border="0"/>
                        </a>
                        &nbsp;&nbsp;&nbsp;

                        <a href="http://www.plus.google.com" style="text-decoration:none;">
                            <img alt="Google+" border="0"/>
                        </a>
                        &nbsp;&nbsp;&nbsp;

                        <a href="http://www.mail.yahoo.com" style="text-decoration:none;">
                            <img alt="Email" border="0"/>
                        </a>
                    </p>
                    <p style="margin-top:0;margin-bottom:8px;font-size:12px;font-weight:bold;">
                        <a style="color:#666666;text-decoration:none;">
                            ABOUT
                        </a>
                        &nbsp;&nbsp;&nbsp;
                        <a style="color:#666666;text-decoration:none;">
                            PRIVACY
                        </a>
                        &nbsp;&nbsp;&nbsp;
                        <a style="color:#666666;text-decoration:none;">
                            TERM OF USE
                        </a>
                    </p>
                    <p style="padding:0;margin:0;font-size:10px;color:#999999;font-weight:bold;">
                        If you would like to change your email notification settings 
                        <a style="color:#44b1d9;" href="www.w3school.com">click here</a>
                    </p>
                    <p style="padding:0;margin:0;font-size:10px;color:#999999;font-weight:bold;">
                        © 2012 Tempo
                    </p>

                </td>               
            </tr>
            </tbody>
        </table>
当我收到电子邮件时的结果

我想把${name}替换为我之前填写的姓名(Bobby)

这是提交电子邮件地址的编码

def send = {    
        sendMail {
            multipart true          
            to params.email
            from "s_yoshitsune@yahoo.com"
            subject "Test Reset Password"
            html params.finePrint
        }       
        render params.finePrint
    }

重置密码
你的电子邮件地址
你的名字
${message(代码:'default.blank.message',args:[消息(代码:'campaign.finePrint.label')])}


在gsp页面中,您可以像这样用html代码预填充
finePrint

<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:javascript src='jquery-1.6.2.min.js'/>
    <g:javascript src='jquery.cleditor.min.js'/>
    <g:javascript src='test.js'/> <%-- cara import file JavaScript/ JS --%>
    <link rel="stylesheet" href="${resource(dir: 'css', file: 'cleditor/jquery.cleditor.css')}" type="text/css"> <%-- cara import file CSS --%>
    <title>Reset Password</title>

</head>

<body>

    <g:form action="send">
        <table style="width:500px">
            <tbody>
                <tr>
                    <td>Your Email Address  </td>
<%--                    <td><input style="width:250px" name="email" /></td>--%>
                    <td><g:textField style="width:250px" name = "email"/></td>
                </tr>
                <tr>
                    <td>Your Name</td>
                    <td><g:textField style="width:250px" name = "user"/></td>
                </tr>
                <tr>
                        <td colspan="4">                            
                            <g:textArea name="finePrint"/>
                        </td>

                 </tr>              
                <tr>
                    <td><input type="submit"/></td>
                </tr>
            </tbody>
        </table>
    </g:form>
<div id="finePrintBlank" style="display:none;" title="${message(code: 'campaign.finePrint.label')}">
    <p>${message(code: 'default.blank.message', args: [message(code: 'campaign.finePrint.label')])}</p>
</div>

</body>

</html>

等
${name},您请求重置密码。
…其余数据。。。

这将在服务器端处理,您应该在名称到达客户端之前解析名称。

在gsp页面中,您可以像这样用html代码预填充
finePrint

<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:javascript src='jquery-1.6.2.min.js'/>
    <g:javascript src='jquery.cleditor.min.js'/>
    <g:javascript src='test.js'/> <%-- cara import file JavaScript/ JS --%>
    <link rel="stylesheet" href="${resource(dir: 'css', file: 'cleditor/jquery.cleditor.css')}" type="text/css"> <%-- cara import file CSS --%>
    <title>Reset Password</title>

</head>

<body>

    <g:form action="send">
        <table style="width:500px">
            <tbody>
                <tr>
                    <td>Your Email Address  </td>
<%--                    <td><input style="width:250px" name="email" /></td>--%>
                    <td><g:textField style="width:250px" name = "email"/></td>
                </tr>
                <tr>
                    <td>Your Name</td>
                    <td><g:textField style="width:250px" name = "user"/></td>
                </tr>
                <tr>
                        <td colspan="4">                            
                            <g:textArea name="finePrint"/>
                        </td>

                 </tr>              
                <tr>
                    <td><input type="submit"/></td>
                </tr>
            </tbody>
        </table>
    </g:form>
<div id="finePrintBlank" style="display:none;" title="${message(code: 'campaign.finePrint.label')}">
    <p>${message(code: 'default.blank.message', args: [message(code: 'campaign.finePrint.label')])}</p>
</div>

</body>

</html>
<g:textArea name="finePrint">
    <table align="center" >
        <tbody>
            ...etc...
            ${name}, you requested to reset your password.
            ...rest of the data... 
        </tbody>
    </table>
<g:textArea>

等
${name},您请求重置密码。
…其余数据。。。


这将在服务器端处理,您应该在名称到达客户端之前解析名称。

我尝试了此html params.finePrint.replaceAll(“${name}”,params.name)…但是错误:'(如何将HTML添加到finePrint字段?硬编码还是客户端?硬编码,,我只是复制我之前创建的gsp中的编码并粘贴到finePrint中。然后我单击按钮阅读编码。您在文本区域使用插件吗?哪一个?谢谢。不…我没有使用任何插件。.文本区域成为finePrint是因为我在文件夹JSi中导入一些文件jQuery.cleditor我尝试了这个html params.finePrint.replaceAll(“${name}”,params.name)…但是错误:'(如何将HTML添加到finePrint字段?硬编码还是客户端?硬编码,,我只是复制我之前创建的gsp中的编码并粘贴到finePrint中。然后我单击按钮阅读编码。您在文本区域使用插件吗?哪一个?谢谢。不…我没有使用任何插件。.文本区域成为finePrint是因为我在文件夹JSuhmm中导入一些文件jQuery.cleditor…如果我这样更改,那么如果我输入另一个编码…而不是“you requested to..etc…”对不起,我的英语不好:Dhmm..我想要任何编码html输入到g:textArea name=“finePrint”中,并且该编码有“${name}”,然后当我收到电子邮件时,我将显示来自textField name=“user”的名称,如果该编码包含${email},则该电子邮件包含来自g:textField name=“email”的电子邮件地址哦,我以为你说你硬编码了它。如果你在客户端更改它,那么直接从文本字段复制值。如果我误解了你的查询,很抱歉。没有。但是之前谢谢你……你对此有什么想法:'(?params.name=params.name.replace('params.user',params.name)嗯…如果我这样改变,那么如果我输入另一个编码…而不是“你要求的…”等…“对不起,我的英语不好:Dhmm..我想要任何编码html输入到g:textArea name=“finePrint”中,并且该编码有“${name}”,那么当我收到电子邮件时,我将显示来自textField name=“user”的名称,如果该编码有${email}然后电子邮件的电子邮件地址是从g:textField name=“email”中获取的。哦,我以为你说你硬编码了它。如果你在客户端更改它,那么直接从textField中复制值。如果我误解了你的查询,很抱歉。没有。但是谢谢你之前…你对此有什么想法吗:'(?params.name=params.name.replace('params.user',params.name)
<g:textArea name="finePrint">
    <table align="center" >
        <tbody>
            ...etc...
            ${name}, you requested to reset your password.
            ...rest of the data... 
        </tbody>
    </table>
<g:textArea>