This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
help me! I had wrote a jsp to update my database .but each time the user refresh the jsp page,the update would invoke one time.how to prevent it?
HASIKA NANAYAKKARA
Greenhorn
Joined: Jun 03, 2001
Posts: 6
posted
0
I GUESS THAT U UPDATE THE DATABASE ON A CLICK EVENT OF A SUBMIT BUTTON;ASSUME THE CAPTION OF THE BUTTON IS "UPDATE" AND THE BUTTON NAME "btnUPDATE".TRY THE FOLLOWING METHOD.IT COULD WORK <% String BUTTON=request.getParameter("btnUPDATE"); if(BUTTON==null)BUTTON="NULL" ; if (BUTTON.equals("UPDATE")){ ://WRITE THE REQUIRED DATABASE UPDATE CODE HERE ://WITHIN THE IF CONDITION } %>
Blood Bigsoon
Greenhorn
Joined: Jun 03, 2001
Posts: 13
posted
0
but if the user refresh the page ,then the update sql will execute again,i had found a way: <% response.setHeader("Expires", "-1"); %> is it right?
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
"bigsoon", The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements. Thanks.