JSP bean获取各种参数

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"/>
<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.

(0)

相关推荐

  • JSP bean获取各种参数

    1.包: 复制代码 代码如下: package beanpackage; /** * * @author lucifer */ public class SystemProperties { public String getRuntimeEnvironmentVersion(){ return System.getProperty("java.version"); } public String getRuntimeEnvironmentVendor(){ return System

  • JSP和JSTL获取服务器参数示例

    复制代码 代码如下: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>JSP和JSTL获取服务器参数</

  • 浅谈SpringMVC jsp前台获取参数的方式 EL表达式

    JAVA: request.setAttribute("msg", "1234"); session.setAttribute("msg2", "1234"); JSP: ${requestScope.msg} ${sessionScope.msg2} JAVA: ModelAndView ModelMap Model里添加的参数 JSP: 直接用${参数名} JAVA: 前台表单里的信息,或者是直接在url后面以?name=

  • JSP页面中文传递参数使用escape编码

    今天在使用中文传递参数时,遇到死活编码转不过去,于是想到了用escape,在使用后 request.getParameter接收不到参数,于是想着怎么能够接收到参数. 经过试验,通过 复制代码 代码如下: zbtmp=escape(escape(zbtmp));//加密2次danielinbiti var params = "name="+zbtmp; window.open('showzsgraph.jsp?params); 然后可以通过request.getParameter获取到

  • Java Spring Controller 获取请求参数的几种方法详解

    Java Spring Controller 获取请求参数的几种方法  1.直接把表单的参数写在Controller相应的方法的形参中,适用于get方式提交,不适用于post方式提交.若"Content-Type"="application/x-www-form-urlencoded",可用post提交 url形式:http://localhost:8080/SSMDemo/demo/addUser1?username=lixiaoxi&password=1

  • 学习SpringMVC——如何获取请求参数详解

    @RequestParam,你一定见过:@PathVariable,你肯定也知道:@QueryParam,你怎么会不晓得?!还有你熟悉的他(@CookieValue)!她(@ModelAndView)!它(@ModelAttribute)!没错,仅注解这块,spring mvc就为你打开了五彩斑斓的世界.来来来,不要兴(mi)奋(hu),坐下来,我们好好聊聊这么些个注解兄弟们~~~(wait, 都没有听过? 好,来,你坐前排,就你!)  一.spring mvc如何匹配请求路径--"请求路径哪家

  • JS获取地址栏参数的两种方法(简单实用)

    js获取地址栏参数的方法有两种:第一种,采用正则表达式获取地址栏参数,第二种,是比较传统的方法,在这小编给大家强烈推荐使用第一种方法,既方便有实用,具体实现过程请看下文详述. 方法一:采用正则表达式获取地址栏参数:( 强烈推荐,既实用又方便!) function GetQueryString(name) { var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window

  • 使用js获取地址栏参数的方法推荐(超级简单)

    方法一:采用正则表达式获取地址栏参数:( 强烈推荐,既实用又方便!) function GetQueryString(name) { var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if(r!=null)return unescape(r[2]); return null; }

  • javascript通过url向jsp页面传递中文参数导致乱码解决方案

    2013-1-16 10:35:49 org.apache.tomcat.util.http.Parameters processParameters 警告: Parameters: Character decoding failed. Parameter 'id' with value '%u8BA2%u5355' has been ignored. Note that the name and value quoted here may corrupted due to the failed

  • jsp Request获取url信息的各种方法对比

    从Request对象中可以获取各种路径信息,以下例子: 假设请求的页面是index.jsp,项目是WebDemo,则在index.jsp中获取有关request对象的各种路径信息如下 String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+&q

随机推荐