注:开发工具,以及jar包下载,404访问处理,请到上篇或下链接!!!
搭建完的目录:
注:此处,如果,只有spring的包,而没有”commons-pool-1.4.jar“和”commons-logging-1.1.1.jar“(版本不限),会在启动tomcat的时候,出现,找不到日志类not found class log,或者线程池错误thread
pool。
然后,本篇,具体springmvc备注细节,why?,可上网查看。
1:使用maven或者,自己导入项目springmvc支持包,可在分析找到
2:配置web.xml配置文件:
配置web.xml文件为:
注:此处注意:<url-pattern>*.html</url-pattern>
3:配置springmvc的配置文件为:
4:配置jsp页面:路径在”/web-inf/views/“下:
index.jsp
home.jsp
home1.jsp
:5:配置springmvc的控制层类,自动通过annotation扫描,此处为homecontroller:
注:此处注意:import org.springframework.web.servlet.modelandview;
浏览器访问:
http://localhost:8080/tsshare
http://localhost:8080/tsshare/index.html
http://localhost:8080/tsshare/index1.html