seckill is not defined 。 改成<script src="<%=basePath%>resources/script/seckill.js" type="text/javascript"></script>
再加入<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>,就可以了
再加入<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>,就可以了
2018-06-02
倒計時出不來的同學(xué)請參考如下script的順序.
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="https://cdn.bootcss.com/jquery.countdown/2.2.0/jquery.countdown.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="https://cdn.bootcss.com/jquery.countdown/2.2.0/jquery.countdown.min.js"></script>
2018-05-28
錯誤: Uncaught TypeError: $.cookie is not a function
解決辦法:
在detail.jsp導(dǎo)入script的bootstrap.min.js下面加上如下導(dǎo)入語句.
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
解決辦法:
在detail.jsp導(dǎo)入script的bootstrap.min.js下面加上如下導(dǎo)入語句.
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
2018-05-27
跟著老師擼了一遍代碼,里面的源碼上傳到github上了,每一步都做了詳細的筆記。跟大家一起交流學(xué)習(xí)
https://github.com/limingval/seckill
https://github.com/limingval/seckill
2018-05-20
受益匪淺,感覺老師講的很不錯,思路清晰,編寫代碼規(guī)范邏輯,雖然有些知識點未接觸,但是根據(jù)老師的思路來,還是比較容易理解的。
2018-05-17
detail.jsp頁面的script代碼那里注意,老師寫錯了下節(jié)debug時才發(fā)現(xiàn),應(yīng)該是:
seckillId:${seckill.seckillId},
seckillId:${seckill.seckillId},
2018-05-10
這節(jié)有些爭議,我也說一些自己的想法,歡迎指正批評
@哀幻暝
除了@Launcher95 所說的 SeckillResult()的 boolean success 值為空,前端拿到時沒辦法處理;還有一個重要的原因,service層中的executeSeckill()之所以要顯示的拋出異常,是為了觸發(fā)spring的聲明式事務(wù)回滾,沒有異常就不會回滾
至于大家說的有些冗余,這個是有一點點,但這樣做是為了規(guī)范,方法的返回值已經(jīng)用泛型規(guī)定了:SeckillResult<SeckillExecution>,所以即便出現(xiàn)異常也需要返回一個SeckillExecution對象
@哀幻暝
除了@Launcher95 所說的 SeckillResult()的 boolean success 值為空,前端拿到時沒辦法處理;還有一個重要的原因,service層中的executeSeckill()之所以要顯示的拋出異常,是為了觸發(fā)spring的聲明式事務(wù)回滾,沒有異常就不會回滾
至于大家說的有些冗余,這個是有一點點,但這樣做是為了規(guī)范,方法的返回值已經(jīng)用泛型規(guī)定了:SeckillResult<SeckillExecution>,所以即便出現(xiàn)異常也需要返回一個SeckillExecution對象
2018-05-09
@xanthuim同學(xué),其實我個人覺得對于異常情況的判斷捕捉,一般情況下越多越全面越好,detail是個get方法,所以可以通過手動拼接地址的方式進去,或防止如果輸入地址的時候?qū)戝e了的情況
2018-05-09