u can use the following methods in a JAva class which needs to be included in the JSp.
//Method to check the date format
public static boolean checkFormat(String date)
{
char ch1,ch2;
date=date.trim();
int len=date.length();
if (len!=10) {
return false;
}
ch1=date.charAt(2);
ch2=date.charAt(5);
if(ch1=='/' && ch2==',') {
return true;
}
else return false;
}
//Method to check if the input date is after the current date
public static boolean after(String inputDate)
{
SimpleDateFormat df= new SimpleDateFormat("MM/dd,yyyy"

;
Date date=null;
try{
date= df.parse(inputDate);
}
catch(ParseException e) {
return false;
}
Date currentDate=new Date();
boolean result=date.after(currentDate);
return result;
}
//Method to compare the input dates
public static int compare(String fromDate,String toDate)
{
SimpleDateFormat df1= new SimpleDateFormat("MM/dd,yyyy"

;
SimpleDateFormat df2= new SimpleDateFormat("MM/dd,yyyy"

;
Date date1=null,date2=null;
try{
date1= df1.parse(fromDate);
date2= df2.parse(toDate);
} catch(ParseException e) {
}
int result=date1.compareTo(date2);
return result;
}
//Method to convert the date format
public static String convertDateFormat(String inputDate)
{
String year=inputDate.substring(0,4);
String month=inputDate.substring(5,7);
String day=inputDate.substring(8,10);
String outputDate=month+"/"+day+","+year;
return outputDate;
}
//Method to validate the date
public static boolean validateDate(String inputDate)
{
java.util.Date dNormalDate;
boolean res=true;
try
{
SimpleDateFormat sdfFormat;
sdfFormat = new SimpleDateFormat("M/d,yyyy"

;
dNormalDate = sdfFormat.parse(inputDate, new ParsePosition(0) );
int dt_l = inputDate.length();
Calendar c = new GregorianCalendar();
c.setTime(dNormalDate);
int cDate = c.get(Calendar.DAY_OF_MONTH);
int cMonth = c.get(Calendar.MONTH) + 1;
int cYear = c.get(Calendar.YEAR);
int iSeparatorA = inputDate.indexOf("/"

;
int iSeparatorB = inputDate.indexOf(","

;
int iMonth = Integer.parseInt(inputDate.substring(0,iSeparatorA));
int iDate = Integer.parseInt(inputDate.substring(iSeparatorA+1, iSeparatorB));
int iYear = Integer.parseInt(inputDate.substring(iSeparatorB+1, dt_l));
if(cDate != iDate || cMonth != iMonth
|| cYear != iYear || iYear < 1753 || iYear > 9999)
{
res = false;
}
} catch(Exception e)
{
res = false;
}
return res;
}