SpringMVC常用注解,返回方式,路径匹配形式

Springmvc详解 mvc是一种软件架构的思想; 阅读详情

1、@RequestMapping注解小结:

       @RequestMapping 可以标注在类定义处,将 Controller 和特定请求关联起来;还可以标注在方法签名处,以便进一步对请求进行分流。配套的属性有:
value 需要跳转的地址
method 基于RestFul的跳转参数,有RequestMethod.get post put delete等
params 符合某个参数的时候才调用该方法
Headers 符合头信息的时候才调用


这样访问http://localhost:8080/××/login/login 就可访问到改方法里了。

2、绑定参数:

1)参数绑定:

@RequestMapping(value="/departments")
public String findDepatment(@RequestParam("departmentId") String departmentId){
    System.out.println("Find department with ID: " + departmentId);
    return "someResult";
}

形如这样的访问形式: /departments?departmentId=23就可以触发访问findDepatment方法了

2)REST风格的参数

   

@RequestMapping(value="/departments/{departmentId}")
public String findDepatment(@PathVariable String departmentId){
  System.out.println("Find department with ID: " + departmentId);
  return "someResult";
}

形如REST风格的地址访问,比如: /departments/23,其中用(@PathVariable接收rest风格的参数
3)REST风格的参数绑定形式之2

  

@RequestMapping(value="/departments/{departmentId}")
public String findDepatmentAlternative(@PathVariable("departmentId") String someDepartmentId){
    System.out.println("Find department with ID: " + someDepartmentId);
    return "someResult";
}

这个有点不同,就是接收形如/departments/23的URL访问,把23作为传入的departmetnId,,但是在实际的方法findDepatmentAlternative中,使用
@PathVariable("departmentId") String someDepartmentId,将其绑定为 someDepartmentId,所以这里someDepartmentId为23

4)url中同时绑定多个id

  

@RequestMapping(value="/departments/{departmentId}/employees/{employeeId}")
public String findEmployee(@PathVariable String departmentId,@PathVariable String employeeId){
    System.out.println("Find employee with ID: " + employeeId + 
      " from department: " + departmentId);
    return "someResult";
}

5)支持正则表达式

   

@RequestMapping(value="/{textualPart:[a-z-]+}.{numericPart:[\\d]+}")
    public String regularExpression(
      @PathVariable String textualPart,
      @PathVariable String numericPart){
     
     
        System.out.println("Textual part: " + textualPart +
          ", numeric part: " + numericPart);
        return "someResult";
    }

注:上面的参数绑定,只是一些一些特殊的。要了解关于springmvc数据绑定,请看这篇文章:http://blog.youkuaiyun.com/liuxiao723846/article/details/43704403


3、springmvc常用注解含义:

 1)@ResponseBody 在方法上标注后,返回String对象的结果为response内容体(response一个json/xml对象),不标注的话作为dispatcher url使用(跳转到视图)

 2)Model对象:model对象有addAttribute(a, b)方法,作用域在request上, 相当于request.setAttribute(),在前端可以通过request.getAttribute()或者EL表达式获取到相应的值。例如:

  

  @RequestMapping(value = "/loginSubmit")
    public String loginSubmit(String loginName,String passwd,HttpServletRequest request,Model model) {
            try {
                User user = loginService.loginSubmit(loginName,passwd);
                request.getSession().setAttribute(Constants.SESSION_USER, user);
                //request.setAttribute("user", user);
                model.addAttribute("user", user);
                return "index";
            } catch (Exception e) {
                logger.error(e.getMessage());
                return  "error/error";
            }
    }

在jsp中可以通过JSTL表达式获取:${user.name}

 3)@ModelAttribute:详见 http://blog.youkuaiyun.com/liuxiao723846/article/details/43713749

 

 4)@SessionAttributes:将结果放入session内


4、springmvc返回类型:

1 使用无返回类型的方法跳转,或者返回ModelMap类型的方法 进行跳转的话,则返回的视图要根据请求方法对应的url名(或者方法名)来定,springmvc会通过视图解析器进行以prefix(前缀)+url名(方法名)+suffix(后缀)组成的页面文件名称.

2 使用一个返回的字符串(String)方法作为跳转,好处就是在return的时候可以自己指定返回的名字,JSP组成是prefix(前缀)+返回的字符串+suffix(后缀)

3 返回一个ModelAndView类型,可以通过ModelAndView构造方法可以指定返回的页面名称,也可以通过setViewName()方法跳转到指定的页面。同时,使用addObject()设置需要返回的模型数据值,这样在视图中就可以通过reuqest.getAttribute()或JSTL表达式获得相应的模型数据值。

实例:

1、使用void方法,此时逻辑视图名由请求处理方法对应的 URL (方法名)确定,这时的视图为welcome

   

@RequestMapping("/welcome")
    public void welcomeHandler() {
    <span style="white-space:pre">    </span>。。。
    }

2、返回ModelMap 和返回类型为 void 一样,逻辑视图名取决于对应请求的 URL(方法名),这时视图为vets。

返回的 ModelMap 将被作为请求对应的模型对象,可以在 JSP 视图页面中访问到

   

 @RequestMapping("/vets")
    public ModelMap vetsHandler() {
         return new ModelMap(this.clinic.getVets());
    }

3、返回string类型,这时视图为ownerForm。(注:这时不能有responseBody,否则就会转成json对象)

   

@RequestMapping(method = RequestMethod.GET)
    public String setupForm(@RequestParam("ownerId") int ownerId, ModelMap model) {
        Owner owner = this.clinic.loadOwner(ownerId);
        model.addAttribute(owner);
        return "ownerForm";
    }

4、返回ModelAndView对象:返回到指定的视图/springmvc/common,同时可以在视图中获得message数据——通过JSTL,${message}

    @RequestMapping("/springmvc/modelAndView")
    public ModelAndView modelAndView(){
          ModelAndView mav = new ModelAndView();
          mav.setViewName("/springmvc/common");
          mav.addObject("message", "modelAndView 方法被调用");
          return mav;
————————————————
转自:https://blog.youkuaiyun.com/liuxiao723846/article/details/43706311

SpringMVC那些事-请求映射匹配-处理器匹配 1.概述 2.主要过程 3.分析 4.相关类 5.部分源码注释 1.概述 根据MVC的概念,我们知道,请求到服务器后都需要经过控制器.这就需要一种机制把请求准确的调用控制器, 也就是需要明确哪个请求要调用哪个处理器.一般的MVC都有自己处理请求和控制器之间的关系映射的方法. 2.主要工作过程 A.根据hm中的request(url,method,header等)根据url 阅读详情

相关推荐

Quest 3开发第一步:搞定Meta账号登录和Oculus软件连不上设备的那些坑(2024实测)

本文详细介绍了Quest 3开发初期的关键步骤,包括Meta账号注册、Oculus软件安装与设备连接等常见问题的解决方案。针对国内开发者遇到的邮箱限制、验证码接收等难题,提供了实用的应对策略,并分享了开发环境配置和常见问题排查技巧,帮助开发者快速搭建Quest 3开发环境。

weixin_30333885的博客 491

SpringMVC 中的常用注解和用法

Spring Web MVC是基于Servlet API构建的原始Web框架,从一开始就包含在Spring框架中。正式名称“Spring Web MVC”来自其源模块(spring-webmvc)的名称,但更常见的名称是“Spring MVC”。从上述定义我们可以得出两个关键信息:1. Spring MVC 是⼀个 Web 框架。2. Spring MVC 是基于 Servlet API 构建的。

m0_62468521的博客 1499

【入门篇】第五章 第一次与 AI Agent 交互

本文介绍了OpenClaw中最基本的用户与AI Agent交互方式,剖析了Agent和Gateway两个核心组件的作用,通过简单示例展示了从用户请求到结果返回的完整执行流程,说明了最小交互过程对验证系统可用性的重要意义,为后续学习复杂任务执行机制奠定基础。

lanyv的博客 512

springMVC实现多个前缀和后缀映射

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.or...

weixin_45128635的博客 2104

2025年12月11日 Coherent收发器下沉到数据中心:调研

技术可行性已基本具备。随着3nm DSP技术的成熟和Coherent-Lite等低功耗方案的推出,Coherent技术与IMDD的功耗差距在800G及以上速率节点快速缩小。特别是在1.6T及更高速率,两种技术的功耗开始趋于收敛。同时,通过系统级优化,如将DSP功能从可插拔模块转移到ASIC芯片,可实现30%以上的功耗降低。在成本方面,硅光技术的进步使得单通道硅光引擎BOM成本降至18美元,较2020年下降62%,逼近InP方案的经济临界点。光学系统机会丰富多样。

weixin_51184047的博客 1167

Proteus仿真实战:用STM32F103C8T6输入捕获模式精准测量PWM频率(附完整代码)

本文详细解析了如何在Proteus仿真环境中,利用STM32F103C8T6的输入捕获模式精准测量PWM频率。文章从输入捕获的工作原理、Proteus电路搭建、模块化代码实现到调试优化,提供了完整的实战指南和代码示例,帮助开发者深入理解并掌握这一关键技术。

weixin_29158047的博客 256

SpringMVC 快速入门

基于尚硅谷 B 站视频 BV1Ry4y1574R 配套笔记改写

Insight720的博客 821

美的集团-数据挖掘工程师面试分享

美的集团-数据挖掘工程师面试分享

510

SpringMVC详解以及注解说明

springMVC详解以及注解说明 基于注释(Annotation)的配置有越来越流行的趋势,Spring 2.5 顺应这种趋势,提供了完全基于注释配置 Bean、装配 Bean 的功能,您可以使用基于注释的 Spring IoC 替换原来基于 XML 的配置。本文通过实例详细讲述了 Spring 2.5 基于注释 IoC 功能的使用。 概述 注释配置相对于 XML 配置具有很多的优势: ...

qq_45740126的博客 496

C# 上位机内存泄漏排查指南:3 个工具 + 4 个技巧,从 GC 频繁到稳定运行 720 小时

C# 上位机内存泄漏排查的核心是「先定位泄漏存在,再追溯引用根源,最后修复验证通过「Visual Studio 诊断工具(快速定位)+ dotMemory(深度分析)+ PerfView(生产监控)」三个工具的配合,结合「复现场景、排查静态成员+事件、检查非托管资源、GC 日志验证」四个技巧,可高效解决绝大多数泄漏问题。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 735

APP爬虫:Airtest的使用和爬取实战详解

Airtest是一个跨平台的自动化测试工具,主要用于移动应用和游戏的UI自动化测试。它支持图像识别、触摸操作、文本输入等功能,能够模拟真实用户的操作行为。此外,Airtest还具备强大的日志记录和报告生成功能,方便开发者进行调试和分析。图像识别:通过截图匹配元素,无需依赖 UI 层次结构。跨平台支持:支持 Android、iOS 和 Windows 应用。简单易用:提供 IDE 和脚本录制功能,降低使用门槛。

数据知道的博客 9618

SpringMVC常用注解,返回方式,路径匹配形式,验证

常用注解元素 @Controller 标注在Bean的类定义处 @RequestMapping 真正让Bean具备 Spring MVC Controller 功能的是 @RequestMapping 这个注解 @RequestMapping 可以标注在类定义处,将 Controller 和特定请求关联起来; 还可以标注在方法签名处,以便进一步对请求进行分流

liang0000zai的专栏 1504

MATLAB R2023a下载链接及软件安装教程

MATLAB的基本数据单位是矩阵,它的指令表达式与数学、工程中常用的形式十分相似,故用MATLAB来解算问题要比用C,FORTRAN等语言完成相同的事情简捷得多,并且MATLAB也吸收了像Maple等软件的优点,使MATLAB成为一个强大的数学软件。a是上半年,b是下半年版本,但是有些小弱们总是觉得只要是b一定功能多,这不一定的,同年版本b比a可能稍微全点,不同年的,比如21b,22a,肯定22a要比21b版本高功能多了。10、选择目标文件夹,默认的是C盘,想修改的话可以单击【浏览】,然后单击【下一步】

qq_53545309的博客 5156

SpringMVC常用注解,返回方式,路径匹配形式,验证【转】

常用注解元素 @Controller 标注在Bean的类定义处 @RequestMapping 真正让Bean具备 Spring MVC Controller 功能的是 @RequestMapping 这个注解 @RequestMapping 可以标注在类定义处,将 Controller 和特定请求关联起来; 还可以标注在方法签名处,以便进一步对请求进行分流 配套的属性有: val

guoguoDJ的博客 2862

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

SpringMVC路径匹配

RESTFUL是一种网络应用程序的设计风格和开发方式,基于HTTP,可以使用XML格式定义或JSON格式定义。RESTFUL适用于移动互联网厂商作为业务接口的场景,实现第三方OTT调用移动网络资源的功能,动作类型为新增、变更、删除所调用资源。

xry12354的博客 471

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

SpringMVC开发常用注解

使用SpringMVC进行开发有多种方式但是在项目中我们经常使用注解形式开发 1.用于声明的注解@Controller @Controller只是定义了一个控制器类,而使用@RequestMapping注解的方法才是真正处理请求的处理器。 仅使用@Controller标记在一个类上还不能真正意义上的说它就是SpringMVC的一个控制类,因为这个时候Spring还不认识它。有了这些注解是不够的,我们需要告诉我们的程序应该去哪里找我们的Controller,这也就是告诉他要扫描我们的那些包: 2.用于匹配请求

weixin_43537696的博客 367

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

SpringMVC的@RequestMapping注解

SpringMVC学习笔记

m0_62434717的博客 995

Java面试题之~Spring、SpringMVC常用注解

Spring、SpringMVC常用注解 Spring通过注解的形式将java类注册成spring bean @Controller:标注一个控制器组件类 @Service:标注一个业务逻辑组件类 @Repository:标注一个DAO组件类 @Component:标注一个普通的Spring Bean类(基本上每一个类都会明确的按照上面得注解去注册,所以该注解不常用了) @Autowired和@Resource 两者的区别 相同点 :两者都是用在属性上,spring可以自动帮你把bean里面引用的对象的g

柠檬喜欢水蜜桃的博客 509

【SpringBoot】| Spring + SpringMVC + SpringBoot 常用注解总结

【SpringBoot】| Spring + SpringMVC + SpringBoot 常用注解总结

m0_61933976的博客 411

SpringMVC注解笔记

笔记不断补充

Diablo__iii的博客 190

spring和springmvc的注解总结

spring和springmvc的常用注解: 注解:参与代码编译,以@开头的。它是给应用程序看的,单独使用注解毫无意义,一定要跟工具一起使用,这个所谓的工具实际就是能读懂注解的应用程序 Spring部分: 声明Bean: @Component:标准一个普通的spring Bean类。 @Controller:标注一个控制器组件类。 可以配合@RequestMapping注解在类上。可以窄化请求 @...

qq_41703795的博客 983

springmvc注解和参数传递

一、SpringMVC注解入门 创建web项目 在springmvc的配置文件中指定注解驱动,配置扫描器 Xml代码 收藏代码 <mvc:annotation-driven /> <context:component-scan base-package=“org.study1.mvc.controller” /> context:component-scan/ 扫描指定的包中的类上的注解,常用的注解有: @Controller 声明A

weixin_43827530的博客 959

注解版开发SpringMVC过程

1.新建一个Moudle,springmvc-03-hello-annotation 。添加web支持!直接新建maven工程就行,在右键add framework support中勾选web支持就可以啦 2.由于Maven可能存在资源过滤的问题,我们将配置完善 在父项目的基础上添加配置: <build> <resources> <resource> <directory>src/main/java</dire

weixin_43323647的博客 181

springmvc注解形式的开发参数接收

@controller:标识当前类是控制层的一个具体的实现 @requestMapping:放在方法上面用来指定某个方法的路径,当它放在类上的时候相当于命名空间需要组合方法上的requestmapping来访问。

jerome 3042
上一篇: 传入0值使用MyBatis查询不生效的原因
下一篇: git强制覆盖所在分支远程代码到本地
墨&汐
博客等级 码龄9年 1粉丝 8原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值