Troubleshooting: JSP unable to display content in Spring MVC

来源:互联网 发布:淘宝仓储服务 编辑:程序博客网 时间:2024/06/07 14:23
I encountered a strange problem in displaying jsp pages in Spring MVC.

I correctly configured view mapping, and jsp file can be found and read by browser, but only code not effect are displayed.

I cannot find others have similar problem.

Finally, after trying lots of possibilities, I found that I incorrectly configured url-pattern in web.xml:

<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

The correct one is :

<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>


0 0
原创粉丝点击