zoukankan      html  css  js  c++  java
  • springmvc学习(三)


    关于springmvc 注解 @RequestMapping 的使用情况

    1. @RequestMapping 可以 用作用于一个类之上
      如果 我的项目名字 叫springmvc :我需要请求访问getUserName 方法 

      此时请求路径是:http://localhost:8080/springmvc/hello.action。如果将RequestMapping  作用于一个类上 则请求地址 http://localhost:8080/springmvc/RequestMapping/hello.action(可以用作区分目录)

    2. @RequestMapping 可以用作 路径映射的数组

      http://localhost:8080/springmvc/request1.action  和http://localhost:8080/springmvc/request.action  都可以请求映射到 reqquestMappingUsage方法上面

    3. @RequestMapping 可以限定请求的方法

      method:默认值是所有的方法都可以请求   上图 表示  该方法 只接受 post 和get的请求 方法 



  • 相关阅读:
    第九章
    第十章
    第八章
    第七章
    第六章
    第五章
    第四章
    第三章
    第二章
    第一章
  • 原文地址:https://www.cnblogs.com/920913cheng/p/10158512.html
Copyright © 2011-2022 走看看