The problem that I can't insert double values with point (example 2.2), however I can insert them with comma (example : 2,2).
but when I want to edit them using (JSP and Ajax), they appear with (point) even if I stock them with comma, so that I have to edit all values !
the scenario is as follows : I want to edit some double values in my application (hibernate and struts2),i pass the values from action to JSP :
private Service Service;
private Vehicule v;
private Map<String, Object> map= new HashMap<>();
public String query()
{
Service = new ServiceImpl();
v = new Vehicule();
v= Service.getVehiculeByImmat(field1);
map.put("date", v.getdate().toString());
map.put("kilometrage", v.getKilometrage());
return "success";
}
then I show them in my JSP :
$(document).ready(function(){
$('#field1').change(function(){
var selectedValue = $('#field1').val();
if ($.trim(selectedValue).length > 0)
{
alert(selectedValue);
$.ajax(
{
type: 'POST',
url : "<s:url action='query'/>",
dataType : 'json',
data: { field1: selectedValue},
success: function(result){
$.each(result, function(key,value)
{ $("#"+key).val(value);
} );
},
});
}
}
);
});
struts.xml
:
<action name="query" class="action.GestionVehicules" method="query">
<result name="success" type="json">map</result>
</action>
my question : it's possible to insert the double values with point ?