Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'email' for method parameter type String is not present]


JavaMailSender的send方法報錯Local address contains illegal character in string

問題分析

本來以為是接收到的參數問題,結果讓前端修改了格式還是報錯
最后在controller打印信息發現是接收參數方式錯了
前端傳的email是JSON對象,類似{"email":"xxx@qq.com"},而我直接使用
@RequestParam("email") String email接收,自然就報錯了

解決方案

將接收參數的方式改為@RequestBody Map<String,Object> map
使用map.get("email")獲取值即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM