![](https://img-blog.csdnimg.cn/img_convert/44f19d57415f1dec538ddcf4ea96f22f.png)
内置tomcat启动后 当我点击删除,页面的控制台报了一个404
![](https://img-blog.csdnimg.cn/img_convert/f98f315b067189e2569be17b006fca55.png)
上面显示说找不到我的路径。这是我写的ajax路径
![](https://img-blog.csdnimg.cn/img_convert/6d23c6143cc2728e37ef34bcf5b11f8e.png)
![](https://img-blog.csdnimg.cn/img_convert/d28e09e84adb51d4341f1514a0137c78.png)
它没有进入到controller层的方法
当我把路径写成下面这样,再用 内置tomcat启动
![](https://img-blog.csdnimg.cn/img_convert/8c650d01fe5e97a2c95e383bf59fd024.png)
再去进行删除
![](https://img-blog.csdnimg.cn/img_convert/4d072d34eb9502fc64e6e09c14b1eb5b.png)
它就删除成功了。
我一直好奇,为什么会这样,以前用全路径就没问题,这下却只能写个方法才能进。
随后我将路径改回全路径,用tomcat插件:tomcat7:run 去运行,再去删除,居然成功了。
总结一下:用内置tomcat启动,路径只需写个方法路径(比如我的全路径是"/user/delUser",在用内置tomcat启动的情况下就写"delUser");用tomcat7:run运行,路劲就要写全路径("/user/delUser")。