aspose file tools
The moose likes Spring and the fly likes Response code from GET request to jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Reply Bookmark "Response code from GET request to jsp page" Watch "Response code from GET request to jsp page" New topic
Author

Response code from GET request to jsp page

Dave Springer
Greenhorn

Joined: Jun 11, 2012
Posts: 3
Hi all,

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??

Thanks very much,

Dave
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56162
    
  13

201 is an odd status to be returning. it means "created" rather than "success".

Is your code doing something to return the 201, or is it the Spring framework doing it?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Dave Springer
Greenhorn

Joined: Jun 11, 2012
Posts: 3
Hi Bear,

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.

Thanks,

Dave
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17225
    
    1

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)

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Dave Springer
Greenhorn

Joined: Jun 11, 2012
Posts: 3
Hi Mark,

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?

Thanks,

Dave
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: Response code from GET request to jsp page
 
Similar Threads
Invoke JSP from within backend code?
Calling servlet on page load
Displaying SOAP response using JSP
response
Bean question