I'm new to spring and working since 2 weeks.
I have spring form which has commandName and without action tag.
for e.g. customersignup.jsp
<spring:form modelAttribute='customer'>
when customersignup.jsp is getting loaded, it will invoke the controller and add customer in model and some data will be populated in form during loading. Once form get loaded, i will fill few more datas in form and submit it. My doubt here is, how form is getting submitted to same controller with POST without action tag.
If we dont have action tag in spring form/jsp, what is happening internally?
Set the method attribute in Spring form as method="post" and set the requestmapping in controller with same URL but with method = RequestMethod.POST
Without action attribute in form the same URL would b used as with "get" but the request mappping would be based on the method type, which is set "post" in form tag; and would ended with same URL as get mapping but Controller endpoint with method = RequestMethod.POST would be called.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With