Grails - 将链接作为参数传递
我在我的网络应用程序中实现了电子邮件共享服务。人们可以单击电子邮件按钮
并访问一个表单,通过该表单可以向他们想要的人发送电子邮件。
我想设置默认的主题
和正文
。
在电子邮件的默认正文
中,我想传递人们想要共享的页面的链接。当然可以这样做,但我做不到。 到目前为止,尝试在文本编辑器的 value
参数中传递链接一直是一个死胡同。我想不出还有什么其他方法可以做到这一点。
任何建议都非常感激。
I have implemented an email sharing service in my web application. People can click on the email button
and access a form with which they can send emails to whom they want.
I would like to set a default subject
and body
.
In the default body text
of the email, I would like to pass the link of the page people want to share. Surely it is possible to do so but I do not manage to.
So far it has been a dead end to try to pass the link in the value
argument of my text editor. I cannot think if any other way to do it.
Any suggestion greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
与将数据传递到要填充的任何其他字段的方式相同。
例如,您的控制器返回一个模型
emailShare
,其中包含subject
、body
和url
等在您的 gsp 中,可以说您的电子邮件正文有一个文本区域,
这会将
url
设置为文本区域中的默认文本,也可以进一步编辑该文本以添加更多文本。The same way you pass data to any other fields that you want to populate.
For example your controller returns a model
emailShare
that containssubject
,body
andurl
etcIn your gsp, lets say you have a textarea for the body of your email,
This will set the
url
as the default text in the textarea, which can also be further edited to add more text.您可以使用 JavaScript 和
document.URL
获取当前页面的位置,然后您只需在表单上设置一个隐藏字段并通过电子邮件请求提交即可。例如:You can get the location of the current page using JavaScript with
document.URL
Then you can just set a hidden field on your form and submit it with your email request. For example: