3

I am trying to submit a login form with the post request but I am not getting all the request parameters (like username, and password) in the controller.

JavaScript code:

loadurl = doamainName + "/ajax-call-handler";
$.ajax({
    url: loadurl,
    method: "POST",
    data: dataField
}).done(function (data) {
}

Controller code:

@RequestMapping(method = RequestMethod.POST, value = "/{languageName}/{pageName}")
    public String handleGetPage(@PathVariable Map<String, String> pathVariables, HttpServletRequest request, HttpServletResponse response) {
        String ajaxPageName = request.getParameter("ajaxPageName");
        if (ajaxPageName == null || ajaxPageName.length() == 0) ajaxPageName = "None";
}
  • Wow, sort your code formatting out! Is this Java Dxa? – Rob Stevenson-Leggett Nov 29 '15 at 20:05
  • Yes. Based on DXA Java 1.0 – Husain Zahid Nov 30 '15 at 11:02
  • 1
    Seems like a general Spring MVC question to me... Anyways, I don't see any evidence in your code samples that request parameters are sent by the client, nor that any are expected by the server (?) – Rick Pannekoek Nov 30 '15 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.