eclipse中使用@RequestMapping注解出错

Ambiguous handler methods mapped for HTTP path 'http://localhost:18080/business/DictionaryController/2': {public java.lang.String com.ztesoft.zsmart.pot.controller.business.dictionary.DictionaryController.deleteDict(java.lang.String) throws com.ztesoft.zsmart.core.exception.BaseAppException, public java.lang.String com.ztesoft.zsmart.pot.controller.business.dictionary.DictionaryController.deleteItem(java.lang.String,java.lang.String) throws com.ztesoft.zsmart.core.exception.BaseAppException}]

异常的大概意思是:模糊映射;

查看action文件,发现没有出现问题

        /*
         * 以下是关于页面中对于父级记录以及子级记录进行删除的操作
         * 1、父级记录的删除按钮跳转
         * 2、子级记录的删除按钮跳转
         */
        delDict: function(dictCode, success) {
            debugger;
            fish.remove("DictionaryController/" + dictCode, success);
        },
        delItem: function(dictCode,itemCode,success) {
            debugger;
            fish.remove("DictionaryController/" + dictCode,itemCode,success);
            debugger;
        },

然后查看controller文件,发现问题所在

    //库表结构左侧删除记录
    @RequestMapping(value = "{dictCode}", method = RequestMethod.DELETE)
    public String deleteDict(@PathVariable String dictCode) throws BaseAppException {
        if (service.deleteDict(dictCode) == 1) {
            return com.ztesoft.zsmart.pot.controller.web.utils.Const.SUCCESS;
        }
        else {
            return com.ztesoft.zsmart.pot.controller.web.utils.Const.FAILED;
        }
    }
    //子级删除操作
    @RequestMapping(value = "{dictCode,itemCode}", method = RequestMethod.DELETE)
    public String deleteItem(@PathVariable String dictCode,@PathVariable String itemCode) throws BaseAppException {
        if (service.deleteItem(dictCode,itemCode) == 1) {
            return com.ztesoft.zsmart.pot.controller.web.utils.Const.SUCCESS;
        }
        else {
            return com.ztesoft.zsmart.pot.controller.web.utils.Const.FAILED;
        }
    }

因为两段代码的value值类似,电脑分不清,所以出现映射模糊的错误。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值