如何在Tapestry5中显示确认消息?
我正在开发一个网站,作为我最后一年项目的一部分,我想显示一条消息来确认电子邮件已发送。
我知道如何在表单上显示自定义错误消息,即在修复以下错误之前您无法继续操作:登录名未知!
我想显示一条消息:您的电子邮件已发送!我发送电子邮件后。 有人告诉我应该通过闪光灯显示此消息。
我不确定如何做到这一点,任何帮助将不胜感激。
I am developing a website as part of my final year project and I want to display a message which confirms that an email has been sent.
I know how to display custom error messages on a form i.e. You cannot go any further until the following errors are fixed : login name not known!
I want to display a message which will say: your email has been sent! after I send an email.
I have been told that I should display this message through the flash.
I am unsure on how to do this, any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的做法是在发送消息时显示的页面上显示条件消息,例如:
页面类片段:
如果您的代码中有其他位置想要显示消息,或者如果您希望喜欢做一些奇特的 AJAX,创建一个消息组件添加到您的布局中可能是一个选择。
The simplest thing to do would be to show a conditional message on the page displayed when the message was sent, like:
Page class snippet:
If you have other places in your code where you'd like to display messages, or if you'd like to do some fancy AJAX, creating a messages component to add to your layout might be an option.
从 Tapestry 5.3 开始,您可以使用警报组件。
模板:
页面类:
Jumpstart 有一个例子。您可以在 http://jumpstart.doublemale.com.au/ 进行尝试Jumpstart7/示例/组件/警报
Since Tapestry 5.3 you can use the Alerts component.
Template:
Page class:
Jumpstart has an example of it. You can play around with it at http://jumpstart.doublenegative.com.au/jumpstart7/examples/component/alerts