how to insert current.date() + 14days into ms sql database as due_date.
and to check a feild enter in jsp form for availability
here are my codes but they are not working
codefor todays DATE: + 14 days
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
// Get a Date object that represents 14 days from now
Date today =new Date();
cal.setTime(today);
cal.add(Calendar.DATE, 14);
Date expiration = cal.getTime();
2.Get availability of book as Y or N display the statment in the same jsp.
<%@page contentType="text/html" import="java.io.*,java.sql.*,javax.sql.*,java.util.*"%>
String lStrBookTitle = request.getParameter("booktitle");
System.out.println("BT "+lStrBookTitle);
String available ="N";
String bookavailable="N";
if(lStrBookTitle !=null && !lStrBookTitle.trim().equals(""))
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:book","scott","tiger");
PreparedStatement pst = con.prepareStatement("select available from book_details where upper(document_title) like '%"+lStrBookTitle.toUpperCase()+"%'");
ResultSet rs = pst.executeQuery();
if(rs.next())
{
available = rs.getString("AVAILABLE");
bookavailable="Y";
}
}
catch(Exception e)
{
System.out.println("Error "+e);
}
}
else
{
lStrBookTitle="";
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Book Borrower</title>
<script>
function fnSearch()
{
if(document.ChkAvailabilty.booktitle.value=="")
{
alert("Enter book title...");
returnfalse;
}
else
{
document.ChkAvailabilty.action="index.jsp";
document.ChkAvailabilty.method="post";
document.ChkAvailabilty.submit();
}
}
</script>
<script>
function ewms_action_validate(){
return ewms_validate();
}
function ewms_validate(){
returntrue;
}
function fnSearch(documentNo){
document.frmReturn.action =
"/wms/retrieve_lib_log?documentNo=" + documentNo;
document.frmReturn.target ="_top";
document.frmReturn.submit();
}
</script>
</head>
</body>
</html>

