Hi,
I am facing a problem with event handling method in Spring portlet mvc 3.
Inside the event method (public final void receiveMessage) i added an attribute into the model
but the attribute is not available in the render method executed after the event request (ofcourse, ${receivedMessage} in JSPs is also empty).Code:model.addAttribute("receivedMessage", msg);
i also tried request.setAttribute("receivedMessage", msg) But no result.
The complete code,
The liferay portal log,Code:@Controller @RequestMapping("VIEW") public class ReceiveMessageController { /** Log. */ private Log log = LogFactory.getLog(ReceiveMessageController.class); @RequestMapping public final String viewMessage(final RenderRequest request, final RenderResponse response, final Model model) { log.debug("inside ReceiveMessageController.viewMessage"); if (!model.containsAttribute("receivedMessage")) { log.debug("receivedMessage is empty"); model.addAttribute("receivedMessage", "no message"); } return "message"; } @EventMapping(value = "{http://jishin.org/events}onMessage") public final void receiveMessage(final EventRequest request, final EventResponse response, final Model model) { log.debug("inside ReceiveMessageController.receiveMessage"); Event event = request.getEvent(); String msg = (String) event.getValue(); log.debug("ReceiveMessageController received message = " + msg); model.addAttribute("receivedMessage", msg); } }
INFO: DEBUG - inside ReceiveMessageController.receiveMessage
INFO: DEBUG - ReceiveMessageController received message = Hello World
INFO: DEBUG - inside ReceiveMessageController.viewMessage
INFO: DEBUG - receivedMessage is empty
Am i doing something wrong, or Is it a bug in Spring Portlet MVC 3 ?
Thanks in Advance,
Jishin


Reply With Quote
