bug收集01

阅读更多

SpringMVC中JSP取不到ModelAndView的数据原因(转)

 

不管是用 ${msg} 还是用JSTL的 都不行

通过这篇文章 http://forum.springsource.org/showthread.php?117394-Unable-to-access-modelAndView-attributes-in-JSP-without-JSTL 

才发现犯了一个平时不会注意的错误 

我是用maven自动生成的web.xml文件 如下:

"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >

 

但这样的文件不行,需要改成

xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

重启就OK了,现在上面的两种方法都支持了

转载:http://www.cnblogs.com/cszzy/archive/2012/12/05/2803652.html

你可能感兴趣的:(bug收集01)