How to get System Date without using Java code?

205 views Asked by At

I want to print date without using Java code in jsp file either using jsp tag library or Expression language.

1

There are 1 answers

0
Shivam Aggarwal On

In your servlet or controller class

DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
request.setAttribute("date", dateFormat.format(date));

where date is set in HttpServletRequest object

In you jsp,just fetch and display the attribute using EL

${date}