Struts2中的TOPIC是什么

发布于 2024-08-04 22:18:27 字数 665 浏览 2 评论 0原文

嗨,我正在用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

海的爱人是光 2024-08-11 22:18:27

对自己的回答:

来自 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. ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文