0

jQuery Ajax 请求

<script>




 function onSubModulesSelect(id, checkbox) {
     alert(id)
        if (checkbox.checked) {
            $.ajax({
                type : 'POST',
                url : 'selectedSubModulesRow.html',
                data : ({
                    checkBoxId : id
                })
            });
        } 
    }

  </script>\\\

控制器

 @RequestMapping(value =Array( "/selectedSubModulesRow.html"))
  @ResponseBody
    def selectedSubModuleRow(@RequestParam checkBoxId: String) {
    println("Reached..!")
    if (checkBoxId != null) {

          println( checkBoxId )

        }
    }

当我按下提交按钮时,它无法解析为控制器方法...浏览器控制台显示一些错误

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/resources/demos/style.css
GET http://localhost:8080/learnware/teacher/selectedSubModulesRow.html?checkBoxId=q1 500 (Internal Server Error) jquery-1.9.1.js:8526
4

1 回答 1

0

在调度程序的配置中,确保映射静态资源:

    <!-- Handles HTTP GET requests for /resources/** by efficiently serving
up static resources in the ${webappRoot}/resources directory -->
<mvc:resources location="/resources/" mapping="/resources/**" />

resources这将导致调度程序 servlet 忽略对应该放置所有静态内容(如 js、css 和图像)的目录中的任何内容的请求。

于 2013-06-05T08:30:46.237 回答