I'm having a problem dealing with Struts 2 and Javascript. This is the javascript code:
geocoder.geocode({'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latitud = results[0].geometry.location.lat();
var longitud = results[0].geometry.location.lng();
document.getElementById("goPlans_evo_latitud").value = latitud;
document.getElementById("goPlans_evo_longitud").value = longitud;
document.getElementById("goPlans").submit();
}
});
When I'm trying to print these two values (latitude & longitude) on the script side it returns this (p.ex.):
41.3970035 2.189719200000013
And if I print them on the action method (after struts 2 set those values on Double objects) it returns this:
4.13970035E8 2.189719200000013E15
I noticed that this a scientific notation. I could try to format them but these values are wrong formatted.
This the action method (very simple):
public String goPlans() {
System.out.println(evo.getLatitud() + " " + evo.getLongitud());
return SUCCESS;
}
Can someone help me to know how set correctly these values using Struts 2?
Thank you.
EDIT: I found the problem! I need to declare the longitude and latitude bean variables as double (primitive) not as Double (Class).