I am working on JSP web page and on an input text where user can select a date on the textbox. I need to retrieve that value and update it on my database by calling a Java method that I created.
So the input looks like below:
End Date:<input class="txtEndDate" type="text" id="txtEndDate" name="txtEndDate" readonly/><br><br>
And my Javascript function as shown:
// function to save data into table
function save() {
var enddate = $('#txtEndDate').val();
<%
// function to update the value
fileFacade.insert_update(id,uniquecode,date,//enddate??);
%>
}
Now I know javascript is client side while Java is back end part but I need to pass enddate to the function parameter. Is there any way I could accomplish this?
EDIT:
updateURL.jsp:
<%@ page import="java.sql.Date" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Locale" %>
<%@include file="../../../WEB-INF/jspf/mcre.jspf" %>
<%@include file="../../../WEB-INF/jspf/session.jspf"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
</head>
<body>
<%
long fileID = Long.parseLong(request.getParameter("id"));
String uniquecode=request.getParameter("uniquecode");
String startdt=request.getParameter("startdate");
String enddate=request.getParameter("enddate");
int enablestatus= Integer.parseInt(request.getParameter("enable"));
fileFacade.insert_update(fileID,uniquecode,startdt,enddate,enablestatus);
%>
</body>
</html>