I have written the code to add a user to the database. The code works when I reload the server. However, when I refresh the page I am expecting the code to be executed again but it does not. Below is the code:
<%@page import="java.sql.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
        <title>Home page</title> 
        <script language="javascript" type="text/javascript">
</script>
    </head> 
    <body> 
        <jsp:useBean id="dataFactory" scope="session"     class="classes.Functions"/>     
       <%
         response.setHeader("Cache-Control","no-cache");
         out.print(dataFactory.getStatus());
         out.print(dataFactory.getError());
       %>
        <form style="text-align:center" name="loginform" action="index.jsp" method="POST">
            <img src="banner-02.jpg" width="700" height="150" alt="banner-02"/>
            <table>
                    <tr>
                         <td>User Name: </td>
                         <td><input type="text" name="UserName" value="" size="40" /></td>
                    </tr>
                    <tr>
                         <td>Password: </td>
                         <td><input type="text" name="Password" value="" size="40" /></td>
                    </tr>
             </table>
             <input type="reset" value="Clear" name="reset" /><input type="submit" value="Submit" name="submit" />
        </form>
    </body> 
 
    