markarnold
May 6th, 2008, 12:12 PM
Hello everybody,
I have a problem with SpringMVC using JSTL JSPs. Controllers and everything else seem to work, but the model objects that I put into the ModelAndView in the controller method are not being evaluated in the JSP.
Here is my Controller:
------------------------------------------------------------------------
public class TestController extends MultiActionController {
public ModelAndView sayHello(HttpServletRequest _req, HttpServletResponse _resp) {
ModelAndView _mv = new ModelAndView("sayHello", "say", "hello");
System.err.println("x='" + _req.getParameter("x") + "'");
return _mv;
}
}
------------------------------------------------------------------------
I put in the 'System.err.println("x=....' to make sure that it does actually call the right method in the right controller, and it does...
Here is my jsp:
------------------------------------------------------------------------
<%@ page session="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<body>
Saying '<c:out value="${say}"/>'...
</body>
</html>
------------------------------------------------------------------------
Here is the HTML source from the browser:
------------------------------------------------------------------------
<html>
<body>
Saying '${say}'...
</body>
</html>
------------------------------------------------------------------------
Does anybody know what my problem is?
This is Spring 2.5.2 on Tomcat 5.0.28 and JDK1.6.0_06
Thanks,
MARK
I have a problem with SpringMVC using JSTL JSPs. Controllers and everything else seem to work, but the model objects that I put into the ModelAndView in the controller method are not being evaluated in the JSP.
Here is my Controller:
------------------------------------------------------------------------
public class TestController extends MultiActionController {
public ModelAndView sayHello(HttpServletRequest _req, HttpServletResponse _resp) {
ModelAndView _mv = new ModelAndView("sayHello", "say", "hello");
System.err.println("x='" + _req.getParameter("x") + "'");
return _mv;
}
}
------------------------------------------------------------------------
I put in the 'System.err.println("x=....' to make sure that it does actually call the right method in the right controller, and it does...
Here is my jsp:
------------------------------------------------------------------------
<%@ page session="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<body>
Saying '<c:out value="${say}"/>'...
</body>
</html>
------------------------------------------------------------------------
Here is the HTML source from the browser:
------------------------------------------------------------------------
<html>
<body>
Saying '${say}'...
</body>
</html>
------------------------------------------------------------------------
Does anybody know what my problem is?
This is Spring 2.5.2 on Tomcat 5.0.28 and JDK1.6.0_06
Thanks,
MARK