Computer >> Máy Tính >  >> Lập trình >> Lập trình

Làm cách nào để in ngày tháng bằng Biểu thức JSP?

Ví dụ sau cho thấy ngày in JSP Expression trên trình duyệt -

<html>
   <head>
      <title>A Comment Test</title>
   </head>
   <body>
      <p>Today's date: <%= (new java.util.Date()).toLocaleString()%></p>
   </body>
</html>

Đoạn mã trên sẽ tạo ra kết quả sau -

Today's date: 11-Sep-2010 21:24:25