String getDateTimeStr(Locale l) { DateFormat df = SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, l); return df.format(new Date()); }

# Example JSP in XML format

This is the output of a simple JSP using XML format.
Use a jsp:scriptlet to loop from 1 to 10:
// Note we need to declare CDATA because we don't escape the less than symbol for (int i = 1; i<=10; i++) { out.println(i); if (i < 10) { out.println(", "); } }
<br><br>

Use a jsp:expression to write the date and time in the browser's locale:
getDateTimeStr(request.getLocale())

This sentence is enclosed in a jsp:text element.