找不到AJAX返回404

I am new to MVC and have been trying to generate a table from a list of objects but the ajax call keeps failing . Am i doing something wrong ? Below is my controller code

     @RequestMapping(value="/PopulateTable",method = RequestMethod.GET,headers="Accept=*/*")
     public @ResponseBody ArrayList<ReportMetrics> doGet(HttpServletRequest 
      request, HttpServletResponse response) throws ServletException, 
      IOException {
      ArrayList<ReportMetrics> metrics=new ArrayList<ReportMetrics>();
     metrics=responseservice.getReportMetrics();;
     return metrics;
     }

My Jquery code is

        <script src="http://code.jquery.com/jquery-latest.min.js"></script>
        <script type="text/javascript">
        $(document).ready(function(){ 
        $("#showTable").click(function(){
               $("div").css("border", "3px solid blue"); 
        $("div").css("border", "3px solid gray");
        $.ajax({
        type: "GET",
        url: "/PopulateTable",
        success: function(data,status)
       {
        createTableByForLoop(data);
        createTableByJqueryEach(data);

       },
       async:   true,
       dataType: 'json'
      }); 
      }); 
      });

have the below dependency already

        <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.13</version>
        </dependency>

error screenshot

Also my URI mapping on web.xml

         <servlet-mapping>
         <servlet-name>SplunkPOC</servlet-name>
         <url-pattern>*.htm</url-pattern>
         <url-pattern>*.*</url-pattern>
         </servlet-mapping>
查看全部
weixin_33695450
weixin_33695450
2017/06/08 08:38
  • ajax
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

1个回复