0

So guys I don't what is going on, I need to add an entry to db table. I created an endpoint that needs as parameter an EnumType called ActionStatisticType but Spring can not map it.

This is the way I'm doing the request in angular:

 this.httpService.put(this.serviceUrl, actionType)

This is the request it creates to backend:

enter image description here enter image description here

This is how I mapped it on spring:

    @RequestMapping(method = RequestMethod.PUT)
    public void create(@RequestParam ActionStatisticType actionType) {
        log.info("#ActionStatisticController.register {}", actionType);
        this.service.create(actionType);
    }

And this is the error I get:

org.springframework.web.bind.MissingServletRequestParameterException: Required ActionStatisticType parameter 'actionType' is not present

I also tried encapsulating it in an object and setting an attrib name but it didn't work either.

Can you please tell me what I'm doing wrong? Thank you.

1 Answers1

0

First of all you need to provide the name of parameter:

@RequestParam(value = "actionType") ActionStatisticType actionType

After that you need to try call URL with the parameter, please see the following example:

https://localhost:8773/webfront/actions?actionType=TEST_ACTION_TYPE

Andrian Soluk
  • 474
  • 6
  • 12