JSP传递数组到JAVA怎么传递

.jsp文件里

<jsp:useBean class="com.gds.rule.Test1" id="test123" scope="page" />
<%
int arr[] = test123.getarr(1,2,3,4,5,6,7,8);
out.print(arr);
%>

.java文件里

public class Test1 extends com.gds.kernal.DBconn {
    public int getarr(int a[]) {

       return a[3];
}

错误:The method getarr(int[]) in the type Test1 is not applicable for the arguments (int, int, int, int, int, int, int, int)。

应该怎么传

OneKi
浏览 2421回答 2
2回答

__innocence

int arr[] = test123.getarr(1,2,3,4,5,6,7,8);Java代码里面传的参数是数组,所以,把上面一句话改成:int arr[] = test123.getarr([1,2,3,4,5,6,7,8]);
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java