BSridhar - 2006-08-28

HI,
I am creating a appln with single form in struts.The form is to insert data into the database.I am using a dispatch action class. I have two methods in the dispatchaction class. in the first method load(),I am retrieving some values from the database while loading the jsp page.so in that function i am creating saveToken(). For inserting I am using another method insert(), in this I am checking the isTokenValid() when the user clicks the submit. But it is returning false everytime. The code is ....

public ActionForward load(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
//some retrieving functionality
;......
.....
saveToken(request);
}

the second method
public ActionForward i(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{

if(isTokenValid(request)){

result =insertdata(bform);//accessing model method
if(result=="success")
{

msg="success";
}

}
else{

System.out.println("in... isnottokenvalid");
msg="failure";
System.out.println("msg>>"+msg);
}
}

I am not able to insert the data atleast once...
can anyone help me with a clear example how to avoid multiple submits and avoid insertions when user refreshes the page..