下面小编就为大家带来一篇基于javaWeb 项目SSM配置要点及可能遇到的问题和解决方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
我发现网上许多讲解javaweb 项目 SSM(Spring,SpringMVC,Mybatis)配置的时候有些重点没有提到,一下我会贴上一些重要的配置和可能出现问题的地方,适合初学者借鉴
1. 新建javaweb项目是可以在新建的时候就选择相关依赖库,也可以用maven导入。
2.在从外部导入依赖库的时候记住要在war 中也导入,否则在服务器上就会找不到相关的依赖库,打包就会失败。
3. 在web.xml 中 配置
<!--1、启动Spring的容器 --><!-- needed for ContextLoaderListener --> contextConfigLoca<div style="color:transparent">来源gaodai.ma#com搞##代!^码@网</div>tionclasspath:applicationContext.xml<!-- springMVC核心配置 --><!-- Bootstraps the root web application context before servlet initialization --> org.springframework.web.context.ContextLoaderListener dispatcherorg.springframework.web.servlet.DispatcherServlet1 dispatcher/
4. 在applicationContext中扫描controller后 就可以简单的访问到Controller中的接口了
后面会继续跟进myBatis对数据库想相关配置
以上就是基于javaWeb 项目SSM配置要点及可能遇到的问题和解决方法的详细内容,更多请关注gaodaima搞代码网其它相关文章!