• springMVC 前台向后台传数组


    前台:

    [java] view plain copy
     
     在CODE上查看代码片派生到我的代码片
    1. $(function() {//点击播放按钮执行的事件  
    2.                             $("#button").click(function(e) {  
    3.                                 alert("kaishi chuanzhi ");  
    4.                                 var ids = [];     
    5.                                 var i = map.size();  
    6.                                 var allValue = map.values();              
    7.                                 for (i; i < allValue.length; i++) {                  
    8.                                 ids.push(allValue[i]);            
    9.                                 }  
    10.                             //  window.href="${ctx}/sitesmanage/video/form?id=${type.id}"  
    11.                             //  window.location.href = "videShowChilds.do?id=" + id;  
    12.                                 $.ajax({   
    13.                                  type: 'POST',   
    14.                                  url:'${ctx}/sitesmanage/video/videoPlay',  
    15.                                  dataType : "json",  
    16.                                  data:{titles:ids},  
    17.                                   error: function (XMLHttpRequest, textStatus, errorThrown) {   
    18.                                       alert(textStatus);   
    19.                                   },   
    20.                                   success: function (data) {   
    21.                                        
    22.                                     alert("ok");  
    23.                                           
    24.                                   }   
    25.                               });   
    26.                               
    27.                             });  
    28.   
    29.                         });  

    后台:

    [java] view plain copy
     
     在CODE上查看代码片派生到我的代码片
    1. @RequestMapping(value = "videoPlays")  
    2.     public String videoPlays(HttpServletRequest request,  
    3.             HttpServletResponse response, ModelMap model,@RequestParam(value = "titles[]") String[] titles) {  
    4.         System.out.println(titles.length+"@@@");  
    5.         //return "modules/sitesmanage/videoPlayForm";  
    6.     return null;  
    7.     }  
  • 相关阅读:
    关于Dockerfile
    hiho一下 第六十四周 Right-click Context Menu
    hdu2642二维树状数组单点更新+区间查询
    东大oj-1511: Caoshen like math
    东大OJ-1588: Routing Table
    东大oj-1591 Circle of friends
    2015年辽宁省赛Interesting Tree
    东大OJ-1544: GG的战争法则
    迷宫问题-广度优先搜索
    vijos P1009清帝之惑之康熙
  • 原文地址:https://www.cnblogs.com/soundcode/p/6520422.html
Copyright © 2020-2023  润新知