I am a beginner when it comes to JSP and SimpleFormController programming.
I am receiving a GET request from a third party company, who are expecting a 200 response code back.
My JSP page is basically blank, but when a GET request comes in, it is automatically submitted to the onSubmit method in my controller, and a http response code of 201 is sent back.
How can I send a 200 response code back, instead of 201??
I don't think so. It is bypassing any code I have in my jsp (a line of code calling a function to send me an email), and going directly to my onSubmit method.
I therefore think it is something in the Spring Framework.
Well, first off. SimpleFormController is an old way of doing Spring MVC. Unless this is a legacy application, I recommend learning the latest Spring MVC which uses Annotations and your Controller classes are POJOs, no extending or implementing any Spring classes.
You can make your Controller return a status code in Spring @MVC by annotating your POJO controller method with @ResponseStatus(HttpStatus.OK)
Thanks for your reply. Unfortunately I am trying to integrate this with an older system, already using the SimpleFormController.
Could the 201 response be due to a new form being created? I have commented out the successView and formView in order to avoid this, but still the same error.
Do you know why my jsp page is being bypassed completely when there is a GET request to it, and going straight to my onSubmit method?