2018年1月23日

@QueryParam NULL but @RequestParam OK

Q:加了@QueryParam 明明有傳參數但 一直抓到null  why!!

A:改用@RequestParam

ref:
https://stackoverflow.com/questions/36392717/queryparam-always-showing-null

Because you are using Spring MVC, which has no connection whatsoever to JAX-RS, which @QueryParam is for. Spring using @RequestParam. If you are going to use Spring, I suggest you get rid of your JAX-RS Dependency, so you don't get confused on what you can and can't use.

沒有留言:

張貼留言