Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. private Service Service;
  2. private Vehicule v;
  3. private Map<String, Object> map= new HashMap<>();
  4.  
  5. public String query()
  6. {
  7.  
  8. Service = new ServiceImpl();
  9. v = new Vehicule();
  10. v= Service.getVehiculeByImmat(field1);
  11. map.put("date", v.getdate().toString());
  12. map.put("kilometrage", v.getKilometrage());
  13.  
  14.  
  15. return "success";
  16.  
  17. }
  18.  
  19. $(document).ready(function(){
  20.  
  21. $('#field1').change(function(){
  22.  
  23.  
  24. var selectedValue = $('#field1').val();
  25. if ($.trim(selectedValue).length > 0)
  26. {
  27. alert(selectedValue);
  28. $.ajax(
  29. {
  30. type: 'POST',
  31. url : "<s:url action='query'/>",
  32. dataType : 'json',
  33. data: { field1: selectedValue},
  34. success: function(result){
  35.  
  36. $.each(result, function(key,value)
  37. { $("#"+key).val(value);
  38. } );
  39.  
  40. },
  41.  
  42. });
  43.  
  44. }
  45.  
  46. }
  47. );
  48.  
  49.  
  50. });
  51.  
  52. <action name="query" class="action.GestionVehicules" method="query">
  53. <result name="success" type="json">map</result>
  54. </action>
  55.  
  56. ActionContext.getContext().setLocale(Locale.US);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement