title: Servlet redirect to same page with error message
body: <p>I have a question about servlet redirection to the same initial page.
  The following is the scenario:
  Suppose a user want to buy an item, so he fills in the amount and submits it. The form is submitted to a servlet and the quantity available is checked against the available in the database. So if the amount of items ordered is more than the available the servlet redirects to the same page but with a message like "item is unavailable". 
  So my question is how to implement this case. How to redirect to the same initial page with an error message. I don't want to use ajax here. </p>
  
  <p>Here is how I have thought of it as : 
  1.)should I set a context attribute if error is generated and then check it again in initial page after re-direction and show the message that has been set.</p>
  
  <p>What are the best practices for this kind of events?</p>