Hello All,
I am new to
struts and new to web development.
I am using a struts based customised framework and i would like to have some suggestion from you guys.
Here is the problem.
I am using
jsp,tiles and struts based framework.
when clicked on back or refresh buttons on the tool bar my page gets resubmitted with duplicate values.
To prevent this i was using saveToken(request) in my page loding part of my action and getting the token value in jsp by sesstion.getAttribute.
In my submiting part of my action i am check if(isTokenValid(request)){ resetToken(request);
This is returning false in all the conditions.
This is what i tried.Please do let me know where i made the mistake.
in my launch part of my action
MyAction
launchLogic{
saveToken(request);
System.out.println("token in diary action: "+session.getAttribute("org.apache.struts.action.TOKEN"));
// launch the page code
}
submitLogic{
if(isTokenValid(request)){
resetToken(request);
// database calls
//setting the values to form
}
in my JSP
<form name="myForm">
<%
String token = ""+session.getAttribute("org.apache.struts.action.TOKEN");
System.out.println("token in jsp page: "+token);
%>
without tokens the submission part is fine if clicked on submit button.
if clicked on back and reset button the page is resubmitting with duplicate values.
My form is in session in action mapping.
Thank you for your time and suggestions in advance.
-regards,
Priyavedan