Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function move(){
- document.getElementById('tgt1').value = document.getElementById('Allocation').value;
- document.getElementById('Allocation').value="";
- document.getElementById("Send").disabled=true;
- }
- function invoke(but)
- {
- if(but==0)
- {
- document.myform.action="Alloc_Insert.do";
- }
- <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>
- ResultSet rs=null;
- String Add=request.getParameter("tgt1");
- String user=(String) session.getAttribute("myusername");
- Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();Date d1 = new Date();
- String d1_str = new SimpleDateFormat("yyyy-MM-dd").format(d1);
- Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");
- PreparedStatement ps=con.prepareStatement("UPDATE SCOPE1 SET ALLOCATED='"+d1_str+"', SPECIALIST='"+user+"' WHERE DBID='"+Add+"'");
- con.setAutoCommit(true);
- int i=ps.executeUpdate();
- if(i==1)
- {
- String redirectURL= "Update_Counts.jsp";
- response.sendRedirect(redirectURL);
- }
- else{
- out.print("retry");
- }
- function test(tg1){
- context = '${pageContext.request.contextPath}';
- var http_request = getXMLHttpRequest();
- if (!http_request) {
- alert('Giving up :( Cannot create an XMLHTTP instance');
- return false;
- }
- http_request.open("POST", context + "/ServletName?tgt1=" + tg1, true);
- http_request.onreadystatechange = function() {
- if (http_request.readyState == 4) {
- if (http_request.status == 200) {
- var response = http_request.responseText;
- //do something if you have a response from the servlet
- }
- }
- };
- http_request.send(null);
- }
- ResultSet rs=null;
- String Add=request.getParameter("tgt1");
- String user=(String) session.getAttribute("myusername");
- Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();Date d1 = new Date();
- String d1_str = new SimpleDateFormat("yyyy-MM-dd").format(d1);
- Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");
- PreparedStatement ps=con.prepareStatement("UPDATE SCOPE1 SET ALLOCATED='"+d1_str+"', SPECIALIST='"+user+"' WHERE DBID='"+Add+"'");
- con.setAutoCommit(true);
- int i=ps.executeUpdate();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement