html中post请求跳转路径错误

问题遇到的现象和发生背景

在做ssm练习时发生了这种问题,html中的post请求路径正确,controller中的RequestMapping地址也正确,结果跳转的时候却跳错误的地址

问题相关代码,请勿粘贴截图

html代码:

  $.post("/ssm/notice/listnotice", app.queryInfo ,function(backData){
            app.tableData = backData.data.currentData;
            app.t = backData.data.totalCount;
            $.get("/ssm/goods/querystate" ,function (backData) {
                app.stateArr = backData.data;
            });
            
        });

controller代码:

@Controller
@RequestMapping("notice")
public class NoticeController {

    @Autowired
    private NoticeService noticeService;

    @RequestMapping("listnotice")
    public AjaxResult list(NoticeQuery noticeQuery){
        return noticeService.listNotice(noticeQuery);
    }
}

运行结果及报错内容

img

Type Status Report

Message /ssm/notice/notice/listnotice

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

我的解答思路和尝试过的方法

为什么会自动再插入一个/notice呢?
并且如果html对应的RequestMapping的地址不存在,报的就是正常的404 Message /ssm/notice/list

这个地方的消息头甚至都是正常的

img

img


这个地方要加个@ResponseBody 注解。不加的话,默认是去找页面路径。

img