I’m writting a webapp that should be able to handle a request as following:
localhost:8080/WeddingApp/report?tid=1
I want that in case the server gets the following requests:
localhost:8080/WeddingApp/report
localhost:8080/WeddingApp/report?tid=
to issue error 404/500 rather than the default 400. Not only changing the page that error 400 redirect to, but to change the error code retrived from the server as well.
How can that be achieved?
Thank you 🙂
Where your code looks for the request parameter
tid, set the response status to your desired code like this:Where
responseis theHttpServletResponsefrom your servlet class: