Advertisement
Guest User

Untitled

a guest
Jan 24th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. function move(){
  2.  
  3. document.getElementById('tgt1').value = document.getElementById('Allocation').value;
  4. document.getElementById('Allocation').value="";
  5. document.getElementById("Send").disabled=true;
  6.  
  7. }
  8. function invoke(but)
  9. {
  10. if(but==0)
  11. {
  12. document.myform.action="Alloc_Insert.do";
  13. }
  14.  
  15. <table><tr><center><td><input type="Submit" value="Allocate" id="Send" onClick="invoke(0);move();" style="width:150px" style="font-size:100%"/></td></center></tr> </table>
  16.  
  17. ResultSet rs=null;
  18. String Add=request.getParameter("tgt1");
  19. String user=(String) session.getAttribute("myusername");
  20. Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();Date d1 = new Date();
  21. String d1_str = new SimpleDateFormat("yyyy-MM-dd").format(d1);
  22. Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");
  23. PreparedStatement ps=con.prepareStatement("UPDATE SCOPE1 SET ALLOCATED='"+d1_str+"', SPECIALIST='"+user+"' WHERE DBID='"+Add+"'");
  24. con.setAutoCommit(true);
  25. int i=ps.executeUpdate();
  26. if(i==1)
  27. {
  28. String redirectURL= "Update_Counts.jsp";
  29. response.sendRedirect(redirectURL);
  30. }
  31. else{
  32.  
  33. out.print("retry");
  34. }
  35.  
  36. function test(tg1){
  37. context = '${pageContext.request.contextPath}';
  38. var http_request = getXMLHttpRequest();
  39. if (!http_request) {
  40. alert('Giving up :( Cannot create an XMLHTTP instance');
  41. return false;
  42. }
  43.  
  44. http_request.open("POST", context + "/ServletName?tgt1=" + tg1, true);
  45. http_request.onreadystatechange = function() {
  46. if (http_request.readyState == 4) {
  47. if (http_request.status == 200) {
  48. var response = http_request.responseText;
  49. //do something if you have a response from the servlet
  50. }
  51. }
  52. };
  53. http_request.send(null);
  54. }
  55.  
  56. ResultSet rs=null;
  57. String Add=request.getParameter("tgt1");
  58. String user=(String) session.getAttribute("myusername");
  59. Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();Date d1 = new Date();
  60. String d1_str = new SimpleDateFormat("yyyy-MM-dd").format(d1);
  61. Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");
  62. PreparedStatement ps=con.prepareStatement("UPDATE SCOPE1 SET ALLOCATED='"+d1_str+"', SPECIALIST='"+user+"' WHERE DBID='"+Add+"'");
  63. con.setAutoCommit(true);
  64. int i=ps.executeUpdate();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement