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
倒計時出不來的同學請參考如下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導入script的bootstrap.min.js下面加上如下導入語句.
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
解決辦法:
在detail.jsp導入script的bootstrap.min.js下面加上如下導入語句.
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
2018-05-27
跟著老師擼了一遍代碼,里面的源碼上傳到github上了,每一步都做了詳細的筆記。跟大家一起交流學習
https://github.com/limingval/seckill
https://github.com/limingval/seckill
2018-05-20
detail.jsp頁面的script代碼那里注意,老師寫錯了下節debug時才發現,應該是:
seckillId:${seckill.seckillId},
seckillId:${seckill.seckillId},
2018-05-10
這節有些爭議,我也說一些自己的想法,歡迎指正批評
@哀幻暝
除了@Launcher95 所說的 SeckillResult()的 boolean success 值為空,前端拿到時沒辦法處理;還有一個重要的原因,service層中的executeSeckill()之所以要顯示的拋出異常,是為了觸發spring的聲明式事務回滾,沒有異常就不會回滾
至于大家說的有些冗余,這個是有一點點,但這樣做是為了規范,方法的返回值已經用泛型規定了:SeckillResult<SeckillExecution>,所以即便出現異常也需要返回一個SeckillExecution對象
@哀幻暝
除了@Launcher95 所說的 SeckillResult()的 boolean success 值為空,前端拿到時沒辦法處理;還有一個重要的原因,service層中的executeSeckill()之所以要顯示的拋出異常,是為了觸發spring的聲明式事務回滾,沒有異常就不會回滾
至于大家說的有些冗余,這個是有一點點,但這樣做是為了規范,方法的返回值已經用泛型規定了:SeckillResult<SeckillExecution>,所以即便出現異常也需要返回一個SeckillExecution對象
2018-05-09
@xanthuim同學,其實我個人覺得對于異常情況的判斷捕捉,一般情況下越多越全面越好,detail是個get方法,所以可以通過手動拼接地址的方式進去,或防止如果輸入地址的時候寫錯了的情況
2018-05-09