我尝试在 JSP 中创建 arrayList 方法,如下所示:
<%!
public int x = 0;
public ArrayList array = new ArrayList();
array.add(new ArrayList());
public ArrayList cidTime (int cid, int w)
{
((ArrayList)array.get(x)).add(cid);
((ArrayList)array.get(x)).add(w);
x++;
return array;
}
%>
但它返回错误:
Syntax error on token(s), misplaced construct(s)
Syntax error on token "add", = expected after this token
有什么建议吗?