I am trying to get ArrayList
in JSP page passed from java class. But eventually I didn't succeed.
Here is what I have done:
Here is my POJO class:
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;
}
}
And this one is Java class where I write business logic:
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;
}
Here is my JSP page:
<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>
It prints the size of ArrayList
in console. But it doesn't create the row.