> Hi all,
> 
> First of all, greetings, from Brazil.
> 
> I would like to populate this Java Script variable with name
> *flightPlanCoordinates
> *from a Action Controller.
> 
> var flightPlanCoordinates = [
> 
> 
> {lat: -23.533592, lng: -46.742744},
> 
> {lat: -23.533592, lng: -46.742744},
> 
> {lat: -23.533870, lng: -46.742804},
> 
> {lat: -23.533978, lng: -46.742890}
> ];
> 
> Whats the best approach to do? I how can I use tag libs from Struts to
> mount this *flightPlanCoordinates ?*
> 
> 
> Thanks in advance,
> 
> 
> Bisconcini


Hi,

it depends how your java classes look like.

If you have a class like this one:

public class Coordinates {
        private double lat;
        private double lng;
}


You could have a list in your acton:

public class SomeAction {
        private List<Coordinates> coordinates;

        ...

        public List<Coordinates> getCoordinates() {
                return coordinates;
        }

}


In a JSP you could access coordinates like this:

var flightPlanCoordinates = [
<s:iterator value="coordinates">
        {lat: <s:property value="lat" />, 
        lng: <s:property value="lng" />},
</s:iterator>
]


Be aware that this is just a very simple example. You should adjust it to 
your app.


Regards,
Christoph

This Email was scanned by Sophos Anti Virus

Reply via email to