diff --git a/spring-mvc-java/src/main/java/org/baeldung/web/controller/ChatController.java b/spring-mvc-java/src/main/java/org/baeldung/web/controller/ChatController.java index 0570636752..5dcbe77cd5 100644 --- a/spring-mvc-java/src/main/java/org/baeldung/web/controller/ChatController.java +++ b/spring-mvc-java/src/main/java/org/baeldung/web/controller/ChatController.java @@ -8,19 +8,12 @@ import org.baeldung.model.OutputMessage; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.handler.annotation.SendTo; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; @Controller public class ChatController { - @RequestMapping(value = "/showChat", method = RequestMethod.GET) - public String displayChat() { - return "chat"; - } - @MessageMapping("/chat") - @SendTo("/topic/") + @SendTo("/topic/messages") public OutputMessage send(final Message message) throws Exception { final String time = new SimpleDateFormat("HH:mm").format(new Date()); diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/view/chat.jsp b/spring-mvc-java/src/main/webapp/resources/chat.html similarity index 86% rename from spring-mvc-java/src/main/webapp/WEB-INF/view/chat.jsp rename to spring-mvc-java/src/main/webapp/resources/chat.html index 1d0d13e211..5704ac7b58 100644 --- a/spring-mvc-java/src/main/webapp/WEB-INF/view/chat.jsp +++ b/spring-mvc-java/src/main/webapp/resources/chat.html @@ -1,84 +1,81 @@ -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> - - - Chat WebSocket - - - - - - - - - - - - - -
-
- - -
-
-
- - -

-
-
- - + + + Chat WebSocket + + + + + + + + + + +
+
+ + +
+
+
+ + +

+
+
+ + \ No newline at end of file