HTTP status 405 – request method ‘get’ not supported using springmvc

Don’t panic in case of data tilt, teach you to easily obtain the slope of table tilt>>>

The get method is not supported. The reason why I made a mistake is that in JSP, I want hyperlink a to be submitted by post, but there was an error when writing JS code here

<script type="text/javascript">
    $(function(){
        $(".delete").click(function(){
            var href = $(this).attr("href");
            $("form").attr("action",href).submit();
            //alert("ok");
            return false;
        })        
    })
</script>

JS code itself is not wrong, the error is the configuration of hyperlinks

<form action="" method="post">
        <input type="hidden" name="_method" value="delete" />
    </form>

    <a href="emp/${emp.id%20}">Delete</a>

The above is the JSP code, and the hyperlink A is missing a class = “delete”

That’s right

<form action="" method="post">
        <input type="hidden" name="_method" value="delete" />
    </form>

    <a class="delete" href="emp/${emp.id%20}">Delete</a>

Similar Posts: