Pase Arraylist de la clase Java y véalo en la página JSP en Struts 2
Estoy tratando de conseguirArrayList
en la página JSP pasada de la clase java. Pero finalmente no tuve éxito. Aquí está lo que he hecho.
Aquí está mi clase de POJO:
public class Coordinates {
private double latitude;
private double longitude;
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
}
Y esta es la clase Java donde escribo lógica de negocios:
public class Leverage extends ActionSupport{
List<Coordinates> mylist = new ArrayList<Coordinates>();
public String getMapDetail()throws Exception{
LevService lev =LevService .getInstance();
mylist = lev .getCurrentLocation();
System.out.println("Size of list is: "+mylist.size());
return SUCCESS;
}
Aquí está mi página JSP:
<Table>
<s:iterator value="mylist" status="Status">
<tr>
<td><s:property value="%{mylist[#Status.index].latitude}" /></td>
<td><s:property value="%{mylist[#Status.index].longitude}" /></td>
</tr>
</s:iterator>
</Table>
Imprime el tamaño deArrayList
en consola Pero no crea la fila.