Home Jsp JSP System.getProperty



JSP System.getProperty
Posted on: February 3, 2009 at 12:00 AM
JSP System.getProperty is performed when you want to view the system properties and display them on the browser.

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:

Related Tags for JSP System.getProperty:
jspbrowserormantformpropertiesviewpropertygetsystemdisplayvirowjsforrowsietowsewsesplpebrowsermmntplaywanjispesemmeprosystiewhensspisproperandrtropewantssthstdispplpropprndono


More Tutorials from this section

Ask Questions?    Discuss: JSP System.getProperty  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.