[an error occurred while processing this directive]

JSP System.getProperty

                          

JSP System.getProperty is performed when you want to view the system properties and display them on the browser.

Understand with Example

This section demonstrates you the use of method system.getProperty(). You can see in the given example that we have create an array of some system properties to display them into the tabular form. The method System.getProperty(pname) get the defined system properties and display them on the browser. In order to get the System properties values you can use System.getProperty ( )

System.get Property ( ) : The method return the system property indicated by the specified key.

Gets the system property indicated by the specified key.

Incase there is a security manager, its checkPropertyAccess method is called with the key as its argument. This may result in a SecurityException.

Parameters: 

key - The name of the system property specified in string and Returns: the string value of the system property, or null if there is no property within the string name.

Here is the code of properties.jsp:

<%@ page language="java" %>
<html>
<body>
<table border="1">
<tr><td><b>Property Names</b></td>
<td><b>Property Values</b></td></tr>
<%
final String[] properties = {
"java.runtime.name",
"java.vm.vendor",
"java.runtime.version",
"java.vendor.url",
"user.timezone",
"user.language",
"os.name",
"sun.desktop"
};
for (int i = 0; i < properties.length; i++) {
String pname = properties[i];
String pvalue = System.getProperty(pname);
%>
<tr>
<td><%= pname %></td>
<td><%= pvalue %></td>
</tr>
<% } %>
</table>
</body>
</html>

Output will be displayed as:

Download Source Code:

                          

[an error occurred while processing this directive]