您的位置: 主页 > 编程开发 > ASP > JSP用bean获取各种参数JSP

JSP用bean获取各种参数JSP
时间:11-10-28 来源:网络 作者:admin 阅览:

  1.包:

  package beanpackage;

  /**
  *
  * @author lucifer
  */
  public class SystemProperties {
  public String getRuntimeEnvironmentVersion(){
  return System.getProperty("java.version");
  }
  public String getRuntimeEnvironmentVendor(){
  return System.getProperty("java.vendor");
  }

   public String getVmVersion(){
  return System.getProperty("java.vm.version");
  }
  public String getVmVendor(){
  return System.getProperty("java.vm.vendor");
  }
  public String getVmName(){
  return System.getProperty("java.vm.name");
  }

   public String getVmSpecVersion(){
  return System.getProperty("java.vm.specification.version");
  }
  public String getVmSpecVendor(){
  return System.getProperty("java.vm.specification.vendor");
  }
  public String getVmSpecName(){
  return System.getProperty("java.vm.specification.name");
  }

  
  public String getRteSpecName(){
  return System.getProperty("java.specification.name");
  }
  public String getRteSpecVersion(){
  return System.getProperty("java.specification.version");
  }
  public String getRteSpecVendor(){
  return System.getProperty("java.specification.vendor");
  }

  
  public String getOperatingSystemName(){
  return System.getProperty("os.name");
  }
  public String getOperatingSystemVersion(){
  return System.getProperty("os.version");
  }
  public String getOperatingSystemArchitecture(){
  return System.getProperty("os.arch");
  }
  }

  2.JSP代码:

  <%--
  Document : usebean
  Created on : 2009-10-3, 13:06:24
  Author : lucifer
  --%>

  <%@page contentType="text/html" pageEncoding="UTF-8"%>
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
  <jsp:useBean id="properties" class="beanpackage.SystemProperties"/>
  <html>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JSP Page</title>
  </head>
  <body>
  Operating System Name:
  <jsp:getProperty name="properties" property="operatingSystemName"/>
  <br>
  Operating System Version:
  <jsp:getProperty name="properties" property="operatingSystemVersion"/>
  <br>
  Operating System Architecture:
  <jsp:getProperty name="properties" property="operatingSystemArchitecture"/>
  <br>
  <br>
  Runtime Environment Version(JDK version):
  <jsp:getProperty name="properties" property="runtimeEnvironmentVersion"/>
  <br>
  Runtime Environment Vendor(JDK vendor):
  <jsp:getProperty name="properties" property="runtimeEnvironmentVendor"/>


ASP相关
关于<< JSP用bean获取各种参数JSP >>的评论 查看所有评论