java - Trouble With Getting Timestamp Info From JSP To Database Using Ajax -
i using ajax retrieve elapsed time 2 on clicks , store in table, trying text appear after each click same table well. below servlet , jsp. can please provide input or explanation?
httpsession session = request.getsession(); string responsetime = request.getparameter("responsetime"); string stimname = request.getparameter("stimname"); string sid = request.getparameter("stimid"); string ar = request.getparameter("act_response"); loginfo log = new loginfo(); log.setuser_response(responsetime); log.setstimname(stimname); log.setstimname(sid); log.setstimname(ar); logdb.insert(log); logdb.selectstim(responsetime); session.setattribute("log", log); string url = "/testcaserun.jsp"; requestdispatcher dispatcher = getservletcontext().getrequestdispatcher(url); dispatcher.forward(request, response); } var starttime; function imageloaded() { starttime = (new date()).gettime(); document.getelementbyid('mybutton').disabled = false; } function submitup() { var endtime = (new date()).gettime(); var elapsed = endtime - starttime; submitajaxrequest(elapsed); alert("elapsed time: " + elapsed); } function submitdown() { var endtime = (new date()).gettime(); var elapsed = endtime - starttime; submitajaxrequest(elapsed); alert("elapsed time: " + elapsed); } function submitajaxrequest(timeelapsed) { $.ajax({ type: "post", // request type url: "ajaxservlet", //request url or servlet mapping url data: "timeelapsed" + timeelapsed, // request data send success: function(msg) { // on successful $('#srverresponse').text(msg); } }); } <input type="image" onclick="submitdown();" src="images.png>
Comments
Post a Comment