Stringutil. Java
Package COM. LH. bean; import Java. util. calendar; public class stringutil {// Date entered by the user: Private string datestr; // determines whether it is today's private Boolean today; // The message private string cue; Public stringutil () {} Public String getdatestr () {return datestr;} public void setdatestr (string datestr) {// Replace the space in the date with "" datestr = datestr. replaceall ("", ""); this. datestr = datestr;} public Boolean istoday () {// splits the date string into an array string datearr [] = Datestr. split ("-"); int year = integer. parseint (datearr [0]); int month = integer. parseint (datearr [1]); int date = integer. parseint (datearr [2]); // obtain the calender object calendar now = calendar for the current system time. getinstance (); int nowyear = now. get (now. year); int nowmonth = now. get (now. month) + 1; int nowdate = now. get (now. day_of_month); If (year = nowyear & month = nowmonth & date = nowdate) {// if the values of year, month, and day are the same, cue = "the input date is Current date! "; Today = true;} else {cue =" the input date is not the current date! "; Today = false;} return today;} Public String getcue () {return cue;} public void setcue (string cue) {This. cue = cue;} public void settoday (Boolean today) {This. today = today ;}}
Index. jsp
<% @ Page Language = "Java" Import = "Java. util. * "pageencoding =" UTF-8 "%> <HTML>
Check. jsp
<% @ Page Language = "Java" Import = "Java. util. * "pageencoding =" UTF-8 "%> <HTML>