I am working on jee project, When I am clicking the submit button, the function of the button is right but the page is refreshing so the data that i entered on text field for example will be deleted!!!
the code of my jsp is:
<div class="col-sm-4">
<input type="submit" name="random_generator" width="200" class="btn btn-primary btn-sm" value="Random Task Generator">
</div>
the code on servlet.java:
if (request.getParameter("random_generator") != null) {
al.clear();
control.clear();
i = Integer.parseInt(request.getParameter("number"));
u = Double.parseDouble(request.getParameter("max"));
b = ta.Random_Tasks_Generator(i, u);
String z = "you have " + i + " tasks," + "\n" + " you must choose a single task to complete the work";
request.setAttribute("btn", z);
}
What should I do to prevent the page refresh?