I have an action prepareEditComment that opens a form and an action editComment that saves something in the database, prepareEditComment is executed via GET, editComment via POST.
With every single click prepareEditComment is executed three times and editComment twice!
saveToken(request) in prepareEditComment and isTokenValid(request) doesn't work for me, because isTokenValid always returns false.
I use
struts 1.2.4 on
Tomcat 5.0.28.
The following should work, but it doesn't:
public ActionForward prepareEditComment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
System.out.println("prepareEditComment");
saveToken(request);
return mapping.findForward("prepareEditComment.success");
}
public ActionForward editComment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
System.out.println("editComment");
if (isTokenValid(request)) {
doSomething();
} else {
resetToken(request);
}
}
Any ideas?