 <p>A simple way to do this is to send a response back to the client in the form of html:</p> <pre><code>response.setContentType("text/html"); PrintWriter out = response.getWriter(); //Returns a PrintWriter object that can send character text to the client out.println("&lt;h1&gt;Registered successfully&lt;/h1&gt;"); </code></pre> <p>For more information, go through these <a href="http://www.tutorialspoint.com/servlets/index.htm" rel="nofollow">Tutorials</a></p> <p>If you dont want the page to reload then you should:</p> <ul> <li>send Ajax request to your servlet via Javascript </li> <li>check the values sent to your Servlet as you are doing right now and send the response as I mentioned in code above (you can send a boolean value for success or failure to later check in Javascript)</li> <li>you you will receive response data in Javascript as Ajax response</li> <li><p>now you can set the result of response accordingly in your specific div.</p> <p>See <a href="http://stackoverflow.com/questions/4112686/how-to-use-servlets-and-ajax">this</a> answer for more information on how to use Ajax with Servlets. </p></li> </ul>