Hi
I am not sure if this post is better suited to Javascript forum or Java. So please let me know if I should send it to Java forum.
Hi
I have a JSP in which three links exist:
Each link forwards the request to the same servlet with different values for the variable myVar. Inside servlet, there are if-else statements for handling each variable value.
The problem is, if the page is refreshed, the value of the last request is still in myVar and it causes actions to happen when they should not. How can I prevent that ?
If the page is displayed for the first time and refreshed this problem does not occur, since myVar is empty. But if the page is used once and it should be used again, and it is refreshed, the value of the request variable remains.
Could you please help?
Thanks
Arshan
I am not sure if this post is better suited to Javascript forum or Java. So please let me know if I should send it to Java forum.
Hi
I have a JSP in which three links exist:
Code:
<a href="javascript:myFunc('<%= request.getContextPath()%>/myservlet?myVar=0')" > Option 0 </a>
<a href="javascript:myFunc('<%= request.getContextPath()%>/myservlet?myVar=1')" > Option 1</a>
<a href="javascript:myFunc('<%= request.getContextPath()%>/myservlet?myVar=2')" > Option 2 </a>
Each link forwards the request to the same servlet with different values for the variable myVar. Inside servlet, there are if-else statements for handling each variable value.
The problem is, if the page is refreshed, the value of the last request is still in myVar and it causes actions to happen when they should not. How can I prevent that ?
If the page is displayed for the first time and refreshed this problem does not occur, since myVar is empty. But if the page is used once and it should be used again, and it is refreshed, the value of the request variable remains.
Could you please help?
Thanks
Arshan
Comment