Saturday, January 17, 2015

Spring Security Problem Cannot Use Method POST

I have expirenced this problem when I was developing my web application using that framework.After I searched on google, I found the solution in stackoverflow.The solution is :

You need to add the following parameter to the end of your action form :

       
?${_csrf.parameterName}=${_csrf.token}

 




As an example here :

       
/admin/products/addproduct?${_csrf.parameterName}=${_csrf.token}

 


If you don't use enctype="multipart/form-data" for your form, you can use the following input :

       
<input type="hidden" name="${_csrf.parameterName}"
                                        value="${_csrf.token}" />


 


Thanks,
Steven Gunanto


No comments:

Post a Comment