• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

response.sendRedirect - affecting the table update

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am facing a situation where the response.sendRedirect is preventing table update.
If anyone has faced simillar situation then please let me know the way out.
thanks in advance,
suresh
SCJP 1.4
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have no idea of the problem you are having. Can you provide more information?
Dave
 
suresh pillai
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the coede:-
//----------------------Code
selectstmt = "DELETE FROM AMDB.WOPAC_PID_PATRON_KEYS WHERE PATRON_KEY='"+patronkey+"'";
stmt.executeUpdate(selectstmt);

selectstmt = "INSERT INTO AMDB.WOPAC_PID_PATRON_KEYS ( PID, PATRON_KEY) VALUES ("+pid+","+patronkey+
")";
ri = stmt.executeUpdate(selectstmt);
//At this point I print out the values in the database into the log file.

stmt.close();
m_conn.close();
if (ri == 0) {
System.err.println("Table update Failed, Patron key: "
+ patronkey);
response.sendRedirect(referer + "authenticate=N&"
+ cgistr);
} else {
System.out.println("Table update Successful, Patron key: "
+ patronkey);

//The table gets updated if I comment following part. If not the page gets redirected but the table does not get updated???
I tried to redirect using javascript :- Window.open(URL,_self) it works ie. the page gets redirected and the table also gets updated. This means that sendredirect is not emptying the buffer before redirecting to the other page..

/*response.sendRedirect(referer + "authenticate=Y&"
+ "LGNT=1&BC=" + uin +"&"
);
*/
}//if
//--------------The program ends here
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic