FAQ Database Discussion Community

Spring MVC : Unable to get json value in jsp, it's giving 0

Need your help. I am not able to get json string in jsp after adding in modelAndView. After debugging, I found it's get added in modelAndView instace. Below is the code snippet: Controller: modelAndView.addObject("json-data",jsonhelper.getJSONString(viewData)); JSP <c:if test="${json-data != null}"> <script type="text/javascript"> window.jsonData =${json-data}; </script> </c:if> Here viewData is the object,...

In my JUnit test, how do I verify a Spring RedirectView?

I'm using Spring 3.2.11.RELEASE and JUnit 4.11. In a particular Spring controller, I have a method that ends thusly ... return new ModelAndView(new RedirectView(redirectUri, true)); In my JUnit test, how do I verify return from a submission to my controller in which this RedirectView is returned? I used to use...