Tablica jako parametr w Struts 2
Mam działanie jak poniżej
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";
}
}
Próbuję wysłać tablicę, wpisując następujący adres URL w pasku adresuhttp://localhost:8080/sm-shop/compare?pids=12,23,34
. Wyjście, którego chcę, to
pid = 12
pid = 23
pid = 34
Ale dostaję to
pid = 122334
Próbowałem googli, ale nie mogłem znaleźć sposobu, aby to zrobić. Pomóż mi dowiedzieć się, co jest nie tak.