you should insert a random funcation into the jsp page first , and when the page is reflashed, the random will be changed ,
and the value will be compare to the value saved in jave code.
when the value is same , the page will do the following action.
otherwise it will not save the value.
following code should insert into the JSP page.
<%
Random rand = new Random();
Integer flag =new Integer(rand.nextInt());
String str_flag = flag.toString();
session.setAttribute("flag1",str_flag);
%>
<input type="hidden" name="flag" value="<%=str_flag%>"/>
here is the code added into jave file.
int i,j;
i = flag1;
j = flag;
if(i==j){
save();
} else {
System.out.println(" don't refleash the page");
}