Struts2中的TOPIC是什么
嗨,我正在用 Tiles 2 学习 struts 2,“主题”这个词出现得非常频繁...... 什么是主题?
例如:
sx:a 标签(特别是 ajax a 模板)和 div 标签支持 ajax 事件系统,提供向主题广播事件的能力。您可以在listenTopics 属性中使用逗号分隔列表来指定要侦听的主题。这意味着当一个主题发布时,通常是通过ajax模板,href属性中指定的URL将被重新请求。
<sx:div theme="ajax" id="weather" href="http://www.weather.com/weather?zip=97239"
loadingText="Loading weather information..."
errorText="Unable to contact weather server"
listenTopics="weather_topic,some_topic">Placeholder...
</sx:div>
<sx:a id="link1"
theme="ajax"
href="refreshWeather.action"
notifyTopics="weather_topic,other_topic"
errorText="An Error ocurred">Refresh</sx:a>
HI, I am learning struts 2 with Tiles 2 and the word "topic" shows up very frequently...
What is a topic?
for example:
The sx:a tag (specifically the ajax a template) and the div tag support an ajax event system, providing the ability to broadcast events to topics. You can specify the topics to listen to using a comma separated list in the listenTopics attribute. What this means is that when a topic is published, usually through the ajax a template, the URL specified in the href attribute will be re-requested.
<sx:div theme="ajax" id="weather" href="http://www.weather.com/weather?zip=97239"
loadingText="Loading weather information..."
errorText="Unable to contact weather server"
listenTopics="weather_topic,some_topic">Placeholder...
</sx:div>
<sx:a id="link1"
theme="ajax"
href="refreshWeather.action"
notifyTopics="weather_topic,other_topic"
errorText="An Error ocurred">Refresh</sx:a>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对自己的回答:
来自 Struts 2 设计和编程 - 教程,Budi kurniawan,第 27 章 - AJAX
除了规范化事件对象之外,Dojo 还支持基于主题的消息传递系统,该系统支持匿名事件通讯。匿名是指您可以连接网页中先前不了解彼此的元素。主题是类似于 Internet 邮件列表的逻辑通道。对邮件列表感兴趣的任何人都可以订阅它,以便在订阅者每次广播消息时收到通知。使用基于主题的消息传递系统(例如 Dojo 中的消息传递系统),Web 对象(按钮、链接、表单、div 元素)可以订阅主题并发布主题。这意味着,AJAX 组件可以被编程为在发布主题时执行某些操作,以及发布可能触发其他订阅者执行某些操作的主题。 ...
answer to myself:
From Struts 2 Design and Programming - A tutorial, Budi kurniawan, Chapter 27 - AJAX
In addition to the normalized event object, Dojo supports a topic-based messaging system that enables anonymous event communication. Anonymous in the sense that you can connect elements in a web page that have no previous knowledge about each other. A topic is logical channel similar to an Internet mailing list. Anyone interested in a mailing list can subscribe to it to get notification every time a subscriber broadcasts a message. With a topic-based messaging system such as that in Dojo, a web object (a button, a link, a form, a div element) may subscribe to a topic and publish a topic. This means, an AJAX component can be programmed to do something upon the publication of a topic as well as publish a topic that may trigger other subscribers to do something. ...