js 不走正常套路
js在 调试的时候很好,但正常运行 老是不进 后台方法 ,我试了 直接跳转 ,post ,ajax 都进不到后台方法里面去,只有用浏览器 debug的时候在 ajax 或者跳转的哪里打个断点 让他一步步走 他才进后台方法 。让人很头疼 。代码如下
<button class="search_btn_right download_margin" onclick="shelf(1)" >上架所有商品</button>
页面上就是一个按钮 ,勾选商品然后点 这个按钮 进入方法。
后台运行没有问题,一直就卡在这里 不知道怎么解决 ,谁来帮我指点迷津,求!
后台代码如下
function shelf(state){
var offCheckBox = document.getElementsByName("commId");
var value = new Array();
for(var i = 0; i < offCheckBox.length; i++){
if(offCheckBox[i].checked)
value.push(offCheckBox[i].value);
}
$.ajax({
type: "post",
url: "<%=path%>/commodity/commShelf",
data:"state="+state+"&check="+value,
success: function(msg){
$("#form2").submit();
},
error:function(msg){
$("#form2").submit();
}
})
}
<button class="search_btn_right download_margin" onclick="shelf(1)" >上架所有商品</button>
页面上就是一个按钮 ,勾选商品然后点 这个按钮 进入方法。
后台运行没有问题,一直就卡在这里 不知道怎么解决 ,谁来帮我指点迷津,求!
后台代码如下
/**
* 获取商品列表
*
*/
@RequestMapping("/getCommList")
public String getCommList(HttpServletRequest request, HttpSession session, Model model) {
String beginDate = request.getParameter("beginDate");
String endDate = request.getParameter("endDate");
String skuid = request.getParameter("skuid");
String currentPage = request.getParameter("curr");
String rowsPerPage = request.getParameter("toRows");
String state = request.getParameter("inlineRadioOptions");
Properties p = PropertiesUtil.UPLOAD_PROPERTIES;
String url = p.getProperty(ConstantUtil.FILE_REMOTE);
Integer states = 0;
try {
// 取出登录用户
Seller user = (Seller) session.getAttribute(What.SESSION_LOGIN_SELLER);
if (user == null) {
return null;
}
Commodity comm = new Commodity();
if (state != null && !state.isEmpty()) {
switch (Integer.parseInt(state)) {
case 0:
comm.setCheckState(0);
states = 0;
break;
case 1:
comm.setCheckState(1);
states = 1;
break;
case 2:
comm.setCheckState(2);
states = 2;
break;
case 3:
comm.setState(0);
states = 3;
break;
case 4:
comm.setState(1);
states = 4;
break;
}
model.addAttribute("state", states);
} else {
model.addAttribute("state", 1);
comm.setCheckState(1);
}
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
comm.setSellerId(user.getId());
Pagination page = new Pagination();
page.getCurrentPage();
page.getStart();
if (currentPage != null && !currentPage.isEmpty()) {
page.setCurrentPage(Integer.parseInt(currentPage));
}
if (rowsPerPage != null && !rowsPerPage.isEmpty()) {
page.setRowsPerPage(Integer.parseInt(rowsPerPage));
}
if (skuid != null && !skuid.isEmpty()) {
comm.setSkuid(skuid);
model.addAttribute("skuid", skuid);
}
if (beginDate != null && !beginDate.isEmpty()) {
comm.setBeginDate(sim.parse(beginDate));
model.addAttribute("beginDate", beginDate);
}
if (endDate != null && !endDate.isEmpty()) {
comm.setEndDate(sim.parse(endDate));
model.addAttribute("endDate", endDate);
}
Integer commCount = CommodityService.getCountOfMap(comm);
page.setTotalCount(commCount);
Map<String, Object> map = new HashMap<String, Object>();
map.put("page", page);
map.put("comm", comm);
List<Commodity> commList = CommodityService.getByMap(map);
model.addAttribute("commList", commList);
model.addAttribute("url", url);
model.addAttribute("page", page);
} catch (ParseException e) {
e.printStackTrace();
}
return "commodity/showCommodityList";
}
...全文
相关推荐
浅谈nodejs中的类定义和继承的套路
本篇文章主要介绍了浅谈nodejs中的类定义和继承的套路,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
js-algorithms-routine:JS刷算法套路
js-algorithms-routine:JS刷算法套路
Javascript面试经典套路reduce函数查重
今天在偶然间查看到了一段代码,代码使用了很短的篇幅完成了字符串统计相同字符次数这个经典面试题,其中用到了reduce这个方法,网上查了查,没有查到什么有价值的东西,导致浪费了我一些时间才看懂,现将我的思路整理如下: 原代码: var arr="qweqrq" var info= arr.split('').reduce((a,b)=> (a[b]++ || (a[b]=1),a) ,{}) console.log(info) 代码思路是这样的,先将字符串arr通过split方法切割成数组,然后使用reduce,这个方法干了什么呢,分为这几步: 1.首先reduce会接收一个callback
Ajax通用套路代码
Ajax 通用套路,javascipt三个方法就可实现ajax功能
详解webpack分包及异步加载套路
本篇文章主要介绍了详解webpack分包及异步加载套路,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧


