简体   繁体   English

在JSP中从服务器到客户端获取事件

[英]Get events from server to client in jsp

We are developing jsr-286 portlet based application with JSP and Javascript as the client-side technology. 我们正在使用JSP和Javascript作为客户端技术来开发基于jsr-286 portlet的应用程序。 When we receive a JMS message in the controller how will client get notified without page refresh. 当我们在控制器中收到JMS消息时,如何在不刷新页面的情况下通知客户端。 We have a constraint not to poll as it causes performance overhead. 我们有一个不轮询的约束,因为它会导致性能开销。 We have tried server sent events and websocket, which works fine in servlets and not in portlets. 我们尝试了服务器发送的事件和websocket,它们在servlet中有效,而在portlet中则不能正常工作。

Is there any way we can achieve this in portlet? 有什么方法可以在portlet中实现?

Use Ajax services. 使用Ajax服务。 Using Ajax you can dynamically update the page based on the server response. 使用Ajax,您可以根据服务器响应动态更新页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM