Share on Google+Share on Google+

Display current time & system properties using JSP expressions

Advertisement
In this Section ,we will display current time and system properties using JSP expressions.

Display current time & system properties using JSP expressions

In this Section ,we will display current time and system properties using JSP expressions.

Description of the program

<%= new java.util.Date() %>

This JSP expression display current date.

 

<%= System.getProperty("java.version")%>

This JSP expression display  currently installed version of java development kit.

 

<%= System.getProperty("java.home")%>

This JSP expression display "jre" directory URL.

 

 <%= System.getProperty("user.name")%>

This JSP expression display the name of currently logged on "user".

 

<%= System.getProperty("os.name")%>

This JSP expression display the name of the currently installed O.S. on system.

<%= System.getProperty("user.dir")%>

This JSP expression display the name of user directory, where your IDE is installed.

 

The code for the following program :

<HTML>

<head><title>DISPLAY DATE & SYSTEM PROPERTY</title></head>

<BODY>

Hello! The time is now <%= new java.util.Date() %>

<br>Java version :  <%= System.getProperty("java.version")%>

<br>Java home :     <%= System.getProperty("java.home")%>

<br>user name :     <%= System.getProperty("user.name")%>

<br>OS name :        <%= System.getProperty("os.name")%>

<br>user dir :           <%= System.getProperty("user.dir")%>

</BODY>

</HTML>

 

Output :

Advertisements

Advertisement

Posted on: June 10, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.