使用Java脚本获得空值,将我的表单提交到新窗口

问题描述

||
function openWindowWithGraph(selectedItems){
            var i=0;
            var form = document.createElement(\"form\");
            form.setAttribute(\"method\",\"post\");
            form.setAttribute(\"action\",\"http://localhost:8080/cmonitor/app/solarPlant/showChart\");
            form.setAttribute(\"target\",\"formresult\");

            alert(selectedItems[0].solarPanel.id);
            for(i=0;i<selectedItems.length;i++){
                var hiddenField = document.createElement(\"input\");              
                hiddenField.setAttribute(\"name\",\"solarPanelIds[\"+i+\"]\");
                hiddenField.setAttribute(\"value\",selectedItems[i].solarPanel.id);
                form.appendChild(hiddenField);
            }

            document.body.appendChild(form);
            window.open(\'\',\'formresult\',\'width=1000,height=1000,toolbar=no \');
            alert(\"hello\");
            form.submit();
        }
这是我的弹簧控制器
@RequestMapping(value=\"/showChart\",method=RequestMethod.POST)
    public ModelAndView showChart(@RequestParam(required=false) Long[] selectedItemIds){
        System.out.println(selectedItemIds);  //getting null in controller
        return new ModelAndView(\"noHeader/solarPlant/chart\");
    }
任何帮助将不胜感激 提前致谢     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)