views:

343

answers:

1

I have an app in J2EE with a couple of projects. Got my .war project that communicates with a EJB business project which has access to some Data.

I have an entity which has some information about places, and I want to show a collection of those places in a single map on a JSF page.

I have a Collection of coordinates to be assigned as points on a polyline in Google maps, and I've got this collection as a return of a java function of the jsf page, but I dont know how to get this collection from jsf and then how to make the map work

I'll be very greatful if someone can give me some jsf code as an example.

(and if someone knows how to set the autoReshape attribute for maps in jsf using javascript, please tell me the secret!!!!)

Thanks a lot.

A: 

You should use the GMaps API, with some JSF output in the javascript. For example;

<script type="text/javascript">
     function onload() {
         <ui:repeat value="#{collection}" var="point">
            map.addOverlay(new GMarker(new GLatLng(#{point.lat}, #{point.lng})));
         <ui:repeat>
     }
</script>

(Use can use other repeat tags as well, or even c:forEach in some cases)

Bozho
hey! thanx.. I know its kinda late, but I have to develop other stuff before this... I'll try this peace of code to see if it helps.. Thanks again
Omer
I tried the code, but I cannot use <ui:repeat ....>, the tag is not recognized, so I tried a simple js "for" instead.. but I get this error:"The content of elements must consist of well-formed character data or markup."Any Idea?
Omer
yup - fix your markup :)for example check if you have imported the "c:" namespace prefix. Or ask another question for the markup problem.
Bozho