2013-11-28 24 views
1

如何取代finePrint中的编码?如何在gsp中替换编码?

enter image description here

大型textarea的我称之为 “的FinePrint” ...... 这是我的问题...我困惑.. 当我充满HMTL的coding..with $ {name}的普惠制。 。 这样的..

enter image description here

看箭头......这就是有一个按钮提交低于finePrint..when我点击... 的G:的“你的名字”这就是我的TextField填写“Bobby”..它将在finePrint中被替换$ {name}的..

这个INI我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> 

,这是我的SMTP编码当我点击submit..it将发送电子邮件为abc @雅虎.COM

def send = {  
     sendMail { 
      multipart true   
      to params.email 
      from "[email protected]" 
      subject "Test Reset Password" 
      html params.finePrint 
     }  
     render params.finePrint 
    } 

,结果当我收到的电子邮件..

enter image description here

我想在那里我之前

这是编码提交电子邮件地址,填补了我的名字(波比)替换$ {name}的..

<!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> 
+0

我想这HTML params.finePrint.replaceAll( “$ {}名”,params.name)..但错误:'( – akiong

+0

你如何在HTML添加到的FinePrint场硬编码或客户方? – aldrin

+0

hardcode ,,我只是复制了我之前创建的gsp中的编码,然后粘贴到finePrint中,然后点击按钮<>来读取编码。 – akiong

回答

2

在GSP页面,您可以预填充finePrint你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> 

这将在服务器端进行处理,你应该有你的名字解析它到达客户端之前。

+0

uhmm ....如果我改变那样,那么如果我输入另一个编码...不像“你要求..等..”对不起,我的英文不好:D – akiong

+0

嗯..我想要任何编码html输入到g:textArea name =“finePrint “并且编码有'$ {name}',那么当我收到电子邮件时,我将显示textField name =”user“的名称,如果该编码具有$ {email},那么电子邮件具有电子邮件地址g:textField name =“email” – akiong

+0

哦,我以为你说你硬编码它。如果您要在客户端上更改它,则直接从文本字段复制值。对不起,如果我误解了你的查询。 – aldrin

0
...etc... 
     ${domainInstance.name}, you requested to reset your password. 
     ...rest of the data...