cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to read values sent by Alfresco.util.Ajax.request

naveenalfresco
Champ in-the-making
Champ in-the-making
Hi,
I am unable to read a set of values in java sent through "Alfresco.util.Ajax.request" by "POST"  method.

sample request code  :
Alfresco.util.Ajax.request(
                 {
                    url: Alfresco.constants.PROXY_URI + "atlantis/sendValue",
                    method: "POST",
                    dataObj:
                    {
                     Value : "val"
                  }
                 });

sample java code :

public class ClassName extends AbstractWebScript {

   public void execute(WebScriptRequest req, WebScriptResponse res){
         req.getParameter("Value ");
   }

}

It works well if i make use of "GET" method because the values get appended to the url like this "/alfresco/s/atlantis/sendValue?Value ="val"" and  req.getParameter("Value ") will read the value as "val" from the url but in-case of "POST" method  the value will not be appended to the url and req.getParameter("Value ") ends up with a null value. I would like to know how to fetch the values.


Regards,
Naveen
1 REPLY 1

arnoldschrijve1
Champ on-the-rise
Champ on-the-rise
In your code there's an extra space after "Value" in req.getParameter("Value "); It seems to me that this space should be removed for getParameter to work.