Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将javascript数组传递给servlet_Java_Javascript_Arrays_Jsp_Servlets - Fatal编程技术网

将javascript数组传递给servlet

将javascript数组传递给servlet,java,javascript,arrays,jsp,servlets,Java,Javascript,Arrays,Jsp,Servlets,我已经看了以前关于这个话题的问题,但我的问题还没有解决 我正在将数组从javascript传递到servlet JavaScript代码: var action = new Array(); function getProtAcionValues(rowNo,columnCount) { for(var j=0;j<columnCount;j++) { action[j] = document.getElementById('textActions'+ro

我已经看了以前关于这个话题的问题,但我的问题还没有解决

我正在将数组从javascript传递到servlet

JavaScript代码:

var action = new Array();
function getProtAcionValues(rowNo,columnCount)
{
    for(var j=0;j<columnCount;j++)
    {
        action[j] =  document.getElementById('textActions'+rowNo+''+j).value;
        alert(action[j]);
    }
}
我发现语法错误:

The method getParameterNames() in the type ServletRequest is not applicable for the arguments (String)

如果代码中有错误,请告诉我。

您只需使用数组名称获取数组即可


字符串操作[]=request.getParameterValues(“操作”)

不能将java数组作为参数传递,因为它是一种结构。最好的方法是将其序列化为类似jSon的字符串对象。你可以用。简单高效。因为您还可以在服务器中序列化,所以它非常有用。

通过表单操作传递Javascript数组变量,将值发送到servlet,然后使用

String[] darray=request.getParameterValues("variable name used with link");

调用servlet的HTML或JavaScript代码在哪里?您可以发布如何将操作数组发送到servlet的代码吗。。。您能否发布如何将动作数组发送到servlet的代码。我的意思是如何将动作[]设置为请求对象,请让我知道这非常有用,因为meTomcat无法识别参数,除非我在名称末尾添加括号,即(“动作[]”)。。
The method getParameterNames() in the type ServletRequest is not applicable for the arguments (String)
String[] darray=request.getParameterValues("variable name used with link");