課程
/后端開發(fā)
/Java
/SpringBoot構(gòu)建電商基礎(chǔ)秒殺項(xiàng)目
??
還有其他的地方會(huì)需要注意的嗎,就是獲取不到session存儲(chǔ)的驗(yàn)證碼
2021-04-03
源自:SpringBoot構(gòu)建電商基礎(chǔ)秒殺項(xiàng)目 3-8
正在回答
你不要在項(xiàng)目外部用文件方式打開,改在項(xiàng)目里操作,具體操作見我上面的貼圖。
同時(shí)檢查你的代碼,嘗試保持跟我以下的代碼一致,試試看
1、UserController 類首處
@RestController
@RequestMapping("/user")
@CrossOrigin(allowCredentials = "true", allowedHeaders = "*")
public class UserController extends BaseController {
2、getOtp方法
@RequestMapping(value = "/getotp", method = {RequestMethod.POST}, consumes = {CONTENT_TYPE_FORMED})
@ResponseBody
public CommonResponse getOtp(@RequestParam(name = "telphone") String telphone){
3、register方法
@Transactional
@RequestMapping(value = "/register", method = {RequestMethod.POST}, consumes = {CONTENT_TYPE_FORMED})
public CommonResponse register(@RequestParam(name = "telphone") String telphone,
可是我就是用的谷歌呀
樓主,我已解決此問(wèn)題,我的代碼沒有問(wèn)題,只需要更改前端訪問(wèn)方式即可。
結(jié)果如下:
此問(wèn)題困擾我2天,內(nèi)心的煎熬萬(wàn)馬奔騰,日不能食、夜不能寢、妹不想把!
終于搞定?。。?/p>
LZ,我也遇到一樣的情況,前后端都跨越授信了啊,sessionOptCodey一直是null,百思不得其解!
各種招都嘗試過(guò)了,依然null,null,null! 請(qǐng)三少老師指點(diǎn)迷津?,多謝?。。?/p>
后端授信:
前端Ajax授信:
1、getotp.html
2、register.html
UserController的代碼:
Debug結(jié)果,困惑ING...
舉報(bào)
應(yīng)用SpringBoot快速搭建擁有用戶、商品、交易及秒殺活動(dòng)的電商秒殺應(yīng)用。
3 回答session中的值獲取不到
3 回答獲取不到Session(),兩次得到的不是同一個(gè)session
6 回答OrderController中獲取的session為空
5 回答session獲取不到
1 回答前端代碼中的data.data.errMsg和data.responseText獲取不到值
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2021-04-07
你不要在項(xiàng)目外部用文件方式打開,改在項(xiàng)目里操作,具體操作見我上面的貼圖。
同時(shí)檢查你的代碼,嘗試保持跟我以下的代碼一致,試試看
1、UserController 類首處
@RestController
@RequestMapping("/user")
@CrossOrigin(allowCredentials = "true", allowedHeaders = "*")
public class UserController extends BaseController {
2、getOtp方法
@RequestMapping(value = "/getotp", method = {RequestMethod.POST}, consumes = {CONTENT_TYPE_FORMED})
@ResponseBody
public CommonResponse getOtp(@RequestParam(name = "telphone") String telphone){
3、register方法
@Transactional
@RequestMapping(value = "/register", method = {RequestMethod.POST}, consumes = {CONTENT_TYPE_FORMED})
@ResponseBody
public CommonResponse register(@RequestParam(name = "telphone") String telphone,
2021-04-07
可是我就是用的谷歌呀
2021-04-07
樓主,我已解決此問(wèn)題,我的代碼沒有問(wèn)題,只需要更改前端訪問(wèn)方式即可。
結(jié)果如下:
此問(wèn)題困擾我2天,內(nèi)心的煎熬萬(wàn)馬奔騰,日不能食、夜不能寢、妹不想把!
終于搞定?。。?/p>
2021-04-06
LZ,我也遇到一樣的情況,前后端都跨越授信了啊,sessionOptCodey一直是null,百思不得其解!
各種招都嘗試過(guò)了,依然null,null,null! 請(qǐng)三少老師指點(diǎn)迷津?,多謝?。。?/p>
后端授信:
前端Ajax授信:
1、getotp.html
2、register.html
UserController的代碼:
Debug結(jié)果,困惑ING...