如何在Spring中将请求参数的value属性数据转换为字符串内容

huangapple go评论128阅读模式
英文:

how to convert the data of value attribute of request parameter to string content in spring

问题

我想获取字符串数据类型中的"ticket id"的值

@RequestParam(value = "ticketId", required = false, defaultValue = "false")

如何获取"ticketId"的值并存储在字符串数据中。

之前我尝试过这样做

@RequestParam(value = "ticketId") String ticketId, required = false, defaultValue = "false"

英文:

i want to get the value of ticket id in string data Type

@RequestParam(value = "ticketId" , required = false, defaultValue = "false")

how can i get the value of ticketId in any string data.

Earlier i have tried to do this

***@RequestParam(value = "ticketId" String ticketId, required = false, defaultValue = "false")***

答案1

得分: 1

除了语法之外,一切都是正确的。
正确的语法:
@RequestParam(value = "ticketId", required = false) String ticketId

英文:

Everything except the syntax is correct.<br>Correct syntax:
<br>@RequestParam(value = &quot;ticketId&quot;, required = false) String ticketId

huangapple
  • 本文由 发表于 2020年1月3日 17:34:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/59576090.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定