我有一个像下面这样的动作
public class CompareAction {
private Long[] pids;
public Long[] getPids() {
return pids;
}
public void setPids(Long[] pids) {
this.pids = pids;
}
public String displayComparison() {
for (Long pid : pids) {
System.out.println("pid = " + pid);
System.out.println();
}
return "success";
}
}
我正在尝试通过在地址栏中键入以下URL来发送数组:http:// localhost:8080 / sm-shop / compare?pids = 12,23,34.我想要的输出是
pid = 12
pid = 23
pid = 34
但我得到的是
pid = 122334
我试过谷歌搜索但无法找到如何做到这一点.请帮我弄清楚什么是错的.