计算机与现代化

• 应用与开发 • 上一篇    下一篇

基于Spring MVC框架的Java Web应用

  

  1. (咸阳师范学院计算机学院,陕西咸阳712000)
  • 收稿日期:2018-02-27 出版日期:2018-09-11 发布日期:2018-09-11
  • 作者简介:葛萌(1980-),女,陕西咸阳人,咸阳师范学院计算机学院讲师,硕士,研究方向:软件工程; 黄素萍(1976-),女,讲师,硕士,研究方向:计算机网络; 欧阳宏基(1982-),男,讲师,硕士,研究方向:软件工程,Java EE应用。
  • 基金资助:
    陕西省教育厅专项科研计划项目(17JK0828); 咸阳师范学院专项科研计划项目(XSYK17029)

Java Web Application Based on Spring MVC Framework

  1. (Computer College, Xianyang Normal University, Xianyang 712000, China)
  • Received:2018-02-27 Online:2018-09-11 Published:2018-09-11

摘要: 基于MVC模式的Web框架能够分离应用的视图、模型和控制器,并能简化控制层的实现,在此研究上提出基于Spring MVC框架的Java Web应用开发方法。首先分析了Spring MVC框架的核心组件以及组件之间的交互过程。然后根据配置文件、Controller组件的实现这2个方面阐述Spring MVC框架的基本应用。最后以异常处理、拦截器和数据校验这3个Web应用中的核心问题给出了Spring MVC的解决方案,以目标考核管理系统为背景给出了部分实现代码。实验表明Spring MVC框架能够提高Java Web应用的稳定性、扩展性和维护性。

关键词: Spring MVC框架, 控制器, 异常处理, 拦截器, 数据校验

Abstract: The Web framework based on MVC mode can separate the view, model, and controller of the application, and can simplify the implementation of the control layer. This paper proposes the development method of Java Web application based on Spring MVC framework. First, it analyzes the core components of the Spring MVC framework and the interaction process between them. Second, the basic application of the Spring MVC framework is expounded from two aspects of the configuration file and the implementation of Controller component. Finally, the solution of Spring MVC is given for the three core problems of Web application which are exception handling, interceptor and data validation, Taking the target assessment management system as an example, a part of the implementation code is given. The experiment shows that the Spring MVC framework can improve the stability, scalability and maintainability of Java Web applications.

Key words: Spring MVC framework, controller, exception handle, interceptor, data validation

中图分类号: