Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Jsp JSP System.getProperty

Related Tutorials


 
 

Share on Google+Share on Google+

JSP System.getProperty

Advertisement
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:

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  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.

Posted on: February 3, 2009

Related Tutorials

Discuss: JSP System.getProperty  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
Binesh.kt
April 8, 2011
jsp

can anybody send me the code for Transaction module in a banking system....pls
DMCA.com