AnsweredAssumed Answered

How can i get parameters in javaback

Question asked by xinyieric on Oct 24, 2011
Latest reply on Oct 25, 2011 by gyro.gearless
Hi,

in surf, i submit a  post request use jquery ajax,
then how can i get the json parameters in javaback?
when i use req.getParameter(), it return null…

surf code:

   $.ajax({
         url : Alfresco.constants.PROXY_URI + "aegis/demo/javabacked",
         type : "POST",
         data : {"test":"aaa","test1":"bbb"},
         dataType : "json",
         contentType : "application/json",
         success : function(response) {
            alert("success");
         },
         error : function() {
            alert("error");
         }
   });

javabacked code:

   protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
      
      Map<String, Object> model = new HashMap<String, Object>(8, 1.0f);
      
      System.out.println(">>>>>>>>>>>>test = " + req.getParameter("test"));
      System.out.println(">>>>>>>>>>>>test1 = " + req.getParameter("test1"));
      
      return model;
   }

thanks

Outcomes