1, Chinese garbled problem in the JSP page: It is usually a problem when the user's input passes the request from a web page to another web page. If the Chinese character obtained if Request.GetParameter () cannot be displayed correctly, such as: string username = request. GetParameter ("UserName"); UserName does not display correctly, add the following sentence: username = new string (username.getbytes ("ISO-8859-1"), "GB2312");
2, get the current time public static string gettime () {string format = "mm-dd-yyyy kk: mm a"; // Format Date and Time SimpleDateFormat Formatter = New SimpleDateFormat (Format); Date Nowdate = New Date () Return formatter.format (nowdate);
3, format the time to display originalTIME indicate that the time of incoming, DestTIME indicates the time of the format conversion time, {date date = null; string desttime = null; // Set time format simpleDateformat bartdateFormat = New SimpleDateFormat ("YYYY-MM-DD KK: MM"); try {/ uses this format to get string time, save as Date object Date = bartdateFormat.Parse (OriginalTime); // To turn into a desired time Type string, but must be format desttime = bartdateformat.format (date);} catch (excetion ex) {system.out.println (ex.getMessage ());} return desttime;}
4, traverside all elements in Request Java.util.Enumeration E = Request.GetParameterNames (); while (E.hasMoreElements ()) {string param = (String) E.NEXTELEMENT (); // Next to the elements}
5. Use the hidden domain of the form to automatically submit the value This value is filled into the relevant location of Request when the user submits the form.