thank you!!! is working.

package com.airwriting.frontend.components;

import org.apache.tapestry5.Asset;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.Path;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;

import com.airwriting.configuration.Configuration;

@Import(library = {"context:js/googlemaps3.js"})
public class GoogleMaps3 {
 @Inject
private Request request;

@Inject
private Configuration configuration;

@Property
private String googleMapsKey;
 @Inject
private JavaScriptSupport jsSupport;

@Inject
@Path("context:/js/omsmin.js")
private Asset asset;

void setupRender(MarkupWriter writer){
  //"
http://maps.googleapis.com/maps/api/js?libraries=geometry&key=${googleMapsKey}&sensor=false
"
 if (request.getServerName().endsWith(".net")){
googleMapsKey = configuration.getString("googleMaps.key.net");
}else if (request.getServerName().endsWith(".de")){
googleMapsKey = configuration.getString("googleMaps.key.de");
}else if (request.getServerName().endsWith(".at")){
googleMapsKey = configuration.getString("googleMaps.key.at");
}
else {//.com
googleMapsKey = configuration.getString("googleMaps.key");
}
 String src = "
http://maps.googleapis.com/maps/api/js?libraries=geometry&key="+
googleMapsKey + "&sensor=false";

writer.getDocument().getRootElement().find("head").elementAt(0, "script",
"type", "text/javascript", "src", asset.toString());
writer.getDocument().getRootElement().find("head").elementAt(0, "script",
"type", "text/javascript", "src", src);
 }

}




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/loading-js-and-scripts-in-a-specific-order-tp5716309p5716318.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Reply via email to