错误是错误的控制器映射。我有:
@MessageMapping("/hello") @SendTo("/topic/greetings") public Greeting greeting(HelloMessage message) throws Exception在jsp中:
stompClient.subscribe("<c:url value='/topic/greetings'/>", function(greeting){...和
stompClient.send("<c:url value='/app/hello'/>", {}, JSON.stringify({ 'name': name }));正确的是:
stompClient.subscribe('/topic/greetings', function(greeting){...stompClient.send('/app/hello', {}, JSON.stringify({ 'name': name }));c:url添加了项目的根目录,当我将其删除时,该应用程序正常运行。但是,在此处使用SockJs创建新套接字时需要c:url(根目录):
var socket = new SockJS("<c:url value='/hello'/>");


