JSP用bean获取各种参数

2016-02-19 13:18 3 1 收藏

今天图老师小编给大家介绍下JSP用bean获取各种参数,平时喜欢JSP用bean获取各种参数的朋友赶紧收藏起来吧!记得点赞哦~

【 tulaoshi.com - Web开发 】

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");
     }

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/webkaifa/)

     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代码:

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/webkaifa/)

%--
    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"
        titleJSP 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"/
         br
         br
         VM Version:
         jsp:getProperty name="properties" property="vmVersion"/
         br
         VM Vendor:
         jsp:getProperty name="properties" property="vmVendor"/
         br
         VM Name:
         jsp:getProperty name="properties" property="vmName"/
         br
         br
         RTE Specification Version:
         jsp:getProperty name="properties" property="rteSpecVersion"/
         br
         RTE Specification Vendor:
         jsp:getProperty name="properties" property="rteSpecVendor"/
         br
         RTE Specification Name:
         jsp:getProperty name="properties" property="rteSpecName"/
         br
         br
         VM Specification Name:
         jsp:getProperty name="properties" property="vmSpecName"/
         br
         VM Specification Version:
         jsp:getProperty name="properties" property="vmSpecVersion"/
         br
         VM Specification Vendor:
         jsp:getProperty name="properties" property="vmSpecVendor"/
    /body
/html

3.输出:

Operating System Name: Windows Vista
Operating System Version: 6.0
Operating System Architecture: x86

Runtime Environment Version(JDK version): 1.6.0_16
Runtime Environment Vendor(JDK vendor): Sun Microsystems Inc.

VM Version: 14.2-b01
VM Vendor: Sun Microsystems Inc.
VM Name: Java HotSpot(TM) Client VM

RTE Specification Version: 1.6
RTE Specification Vendor: Sun Microsystems Inc.
RTE Specification Name: Java Platform API Specification

VM Specification Name: Java Virtual Machine Specification
VM Specification Version: 1.0
VM Specification Vendor: Sun Microsystems Inc.

来源:http://www.tulaoshi.com/n/20160219/1603757.html

延伸阅读
标签: Web开发
例如 当前你的URL是: http://www.warting.com/index.php?test=1&kk=2 如果想获取test,则可以引入插件后, 用如下方法获取: var test = $.query.get('test'); 如果参数有多个相同的名称 ,则可以这样: var arr = $.query.get('testy'); 输出: [ 值1 , 值2, 值3...] 如果要获取多个相同名称中的某一个,可以这样: var arr...
1、打印机的分辨率(象素/英寸) X方向分辨率=GetDeviceCaps(Printer-Handle,LOGPIXELSX); Y方向分辨率=GetDeviceCaps(Printer-Handle,LOGPIXELSY); 2、打印纸的大小(以象素为单位) 通过Printer的PageWidth和PageHeight属性可得到可打印范围的象素数 物理象素数用以下API得到: 宽=GetDeviceCaps(Printe...
标签: Web开发
script     url = location.search.substr(1);     if(url.length 0)     {       ar = url.split(/[&=]/);       for(i=0;iar.length;i+=2)       {         alert("参...
标签: Web开发
最近做个页面,需要用javascript获取url参数,可发现网上的东西,实在是多了,错误也实在是多啊,真晕,浪费了我不少时间于是,我便总结一下,一个好用的就可以了,先声明下,用正则,是简单,但多浏览器的兼容性,和速度不敢保证了,所以我就用个多浏览器兼容的 代码如下: script language = javascript function reque...

经验教程

437

收藏

28
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部