报错Required String parameter 'productId' is not present的原因及处理办法

如果你遇到改错时,很快能也是你的方法中设置了形参,但是在访问该方法时,你却没有传参,所以你就看到了如下错误

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Oct 03 18:51:07 CST 2018

There was an unexpected error (type=Bad Request, status=400).

Required String parameter 'productId' is not present

但是在实际开发中,我们就是需要这种操作,比如说我们把新增和修改商品放在一个页面去做,新增时我们是不需要传商品id的,那我们如何解决这个问题你呢?  如图所示,这样就能解决这个问题啦!

报错Required String parameter 'productId' is not present的原因及处理办法