eclipse建立springMVC 简单项目

http://jinnianshilongnian.iteye.com/blog/1594806

如何通过eclipse建立springMVC的简单项目,现在简单介绍一下。

工具/原料

 
  • eclipse
  • 相关jar包

方法/步骤

 
  1. 新建一个动态web项目,选择 Dynamic Web Project 点击 NEXT  填写项目名称,点NEXT  NEXT  选中Generate web.xml 选项,结束。

    eclipse建立springMVC 简单项目
    eclipse建立springMVC 简单项目
    eclipse建立springMVC 简单项目
  2. 在项目下建立相关文件夹,包括java,resources(存放spring等资源文件),view(存放动态页面),右键点击项目,修改properties -> sources 为java和resources(新建资源文件夹)

    eclipse建立springMVC 简单项目
    eclipse建立springMVC 简单项目
    eclipse建立springMVC 简单项目
  3. 引入相关jar包,如下,包括 commons-logging-1.1.1.jar;spring-beans-

    4.0.5.RELEASE.jar;spring-context-4.0.5.RELEASE.jar;spring-context-support-4.0.5.RELEASE.jar;spring-core-4.0.5.RELEASE.jar;spring-expression-4.0.5.RELEASE.jar;spring-web-4.0.5.RELEASE.jar;spring-webmvc-4.0.5.RELEASE.jar;spring-webmvc-portlet-4.0.5.RELEASE.jar等

    eclipse建立springMVC 简单项目
  4. 修改web.xml文件,增加spring等相关内容。

    在resources目录下新建spring目录文件夹,在其中新建springMVC.xml,applicationContext-web.xml配置文件,编辑相关内容。

    eclipse建立springMVC 简单项目
    eclipse建立springMVC 简单项目
    eclipse建立springMVC 简单项目
  5. 在view目录下建index.jsp,编辑页面内容保存。修改web.xml,建欢迎页:

     <welcome-file-list>

        <welcome-file>view/index.jsp</welcome-file>

      </welcome-file-list>

    保存。

    eclipse建立springMVC 简单项目
  6. 建立spring controller 文件 新建class文件 ;编辑返回页面 byebye.jsp

    eclipse建立springMVC 简单项目
    eclipse建立springMVC 简单项目
  7. 通过tomcat启动,在浏览器输入:http://localhost:9090/springMVC/ 即可,点击链接,调用controller返回byebye页面,至此项目建立成功。

    eclipse建立springMVC 简单项目
    eclipse建立springMVC 简单项目

转载于:https://www.cnblogs.com/AmilyWilly/p/6200959.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值