0

I see there are many questions for this question but nothing is helping. I can't find the solution. I can't set up the button links correctly.

Controller:

    @RequestMapping(value="/deleteProperty/{idProperty}", method = RequestMethod.DELETE)
    public String deleteProperty1(@PathVariable("idProperty") int idProperty) {
        propertyService.deleteById(idProperty);
        return "redirect:/admin/properties/allProperties";
    }

Update button:

@{/admin/properties/deleteProperty(idProperty=${tempProperty.idProperty})}"

Delete button:

@{/admin/properties/deleteProperty/{idProperty}'(idProperty=${tempProperty.idProperty})}"
Developer
  • 35
  • 12
  • `@{/admin/properties/deleteProperty{idProperty}'(idProperty=${tempProperty.idProperty})}"` there should not be apostrophe(') after `{idProperty}`. Try this `"@{/admin/properties/deleteProperty/{idProperty}(idProperty)=${tempProperty.idProperty}"` – dhakalkumar Dec 31 '21 at 06:59
  • @dhakalkumar I got this error Caused by: org.attoparser.ParseException: Could not parse as expression: "@{/admin/properties/deleteProperty{idProperty}(idProperty)=${tempProperty.idProperty})}" – Developer Dec 31 '21 at 15:21
  • If that is the exact error message you get, looks like you missed a / between `deleteProperty` and `{idProperty}` --> `@{/admin/properties/deleteProperty/{idProperty}(idProperty)...` – dhakalkumar Jan 01 '22 at 16:22
  • I have tried that too. When I added that slash you mentioned I got the Whitelabel error page... – Developer Jan 01 '22 at 17:08
  • In the controller methods, you can add a line `System.out.println(method-name)` to see which method is being called when you click on the buttons. If nothing is printed in the console, your code is not reaching the controller. – dhakalkumar Jan 02 '22 at 06:59
  • Browsers can normally only do GET and POST requests (unless you are using JavaScript to send an AJAX request). How are you getting the browser to submit a DELETE request? Is it just a `
    ` because that won't work.
    – Metroids Dec 25 '22 at 00:53

0 Answers0