1

I ain't able to open the controller's method

var url = "UsersGroupReader";
if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.onreadystatechange = processAccessGroupRequest;
req.open("GET", url, true); 
req.send(null);

My controller is:

@RequestMapping(value = "UsersGroupReader", method = RequestMethod.GET)
public Vector<String> readUsersGroup(HttpServletRequest request,
        HttpSession httpSession) {

The req.status I am receiving is 404 through AJAX.

The pattern in my web.xml is as follows:

<servlet-mapping>
    <servlet-name>login</servlet-name>
    <url-pattern>*.html</url-pattern>
</servlet-mapping>

I tried using UsersGroupReader.html in both the AJAX function and the controller but still unable to access the controller.

Can anyone help me spot the mistake?
Could be a duplicate of this, in vain even after following it.

Thanks in Advance

3
  • var url = "/UsersGroupReader.html"; Commented Feb 5, 2013 at 15:45
  • @Quoi I tried that too. It didn't work. Commented Feb 5, 2013 at 15:49
  • install firebug plugin in mozila and debug it. Believe me it makes your life easy. Commented Feb 5, 2013 at 15:51

1 Answer 1

2

It's likely that the request you are sending is either not being received by the intended server or that the DispatcherServlet is not being invoked for the request. To troubleshoot these type of issues you can usually find the actual cause by:

  1. Use your browser's developer toolbar to determine the exact URL being sent in the request.
  2. Turn up Spring's logging to debug to find out what it is doing when it receives the request (if it receives the request).
  3. Adjust the servlet-mapping accordingly.
Sign up to request clarification or add additional context in comments.

1 Comment

I checked the URL and I found my mistake. I missed the query string which proved vital. Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.