“参数"的含义在@RequestMapping注释中? [英] Meaning of "params" in @RequestMapping annotation?

查看:218
本文介绍了“参数"的含义在@RequestMapping注释中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在基于Spring MVC的应用程序中使用的@RequestMapping注释.

I am aware of @RequestMapping annotation which is used in Spring MVC based application.

我遇到了这段代码:

@RequestMapping(method = POST, params = {"someParam"})

我理解了method.但是我不知道params是什么意思?在此之前,我从未见过将参数传递给此批注的任何内容.

I understood the method. However I don't know what params means? Before this I never had seen anything which passed params to this annotation.

任何人都可以帮助您理解这一点吗?

Can anyone help in understanding this?

推荐答案

您的示例意味着参数someParam必须出现在请求中.这用于缩小给定请求的匹配方法.

Your example means that the parameter someParam must be present in the request. This is used to narrow down the matching methods for the given request.

请参阅文档: RequestMapping#params

这篇关于“参数"的含义在@RequestMapping注释中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆