ASCII码 ASCII码

JSP bean获取各种参数

发布于:2022-03-30 13:13:40  栏目:技术文档
  1. JSP bean获取各种参数
  1. JSP bean获取各种参数的实现代码。
  2. 1.包:
  1. package beanpackage;
  2. /**
  3. *
  4. * @author lucifer
  5. */
  6. public class SystemProperties {
  7. public String getRuntimeEnvironmentVersion(){
  8. return System.getProperty("java.version");
  9. }
  10. public String getRuntimeEnvironmentVendor(){
  11. return System.getProperty("java.vendor");
  12. }
  13. public String getVmVersion(){
  14. return System.getProperty("java.vm.version");
  15. }
  16. public String getVmVendor(){
  17. return System.getProperty("java.vm.vendor");
  18. }
  19. public String getVmName(){
  20. return System.getProperty("java.vm.name");
  21. }
  22. public String getVmSpecVersion(){
  23. return System.getProperty("java.vm.specification.version");
  24. }
  25. public String getVmSpecVendor(){
  26. return System.getProperty("java.vm.specification.vendor");
  27. }
  28. public String getVmSpecName(){
  29. return System.getProperty("java.vm.specification.name");
  30. }
  31. public String getRteSpecName(){
  32. return System.getProperty("java.specification.name");
  33. }
  34. public String getRteSpecVersion(){
  35. return System.getProperty("java.specification.version");
  36. }
  37. public String getRteSpecVendor(){
  38. return System.getProperty("java.specification.vendor");
  39. }
  40. public String getOperatingSystemName(){
  41. return System.getProperty("os.name");
  42. }
  43. public String getOperatingSystemVersion(){
  44. return System.getProperty("os.version");
  45. }
  46. public String getOperatingSystemArchitecture(){
  47. return System.getProperty("os.arch");
  48. }
  49. }
  1. 2.JSP代码:
  1. <%--
  2. Document : usebean
  3. Created on : 2009-10-3, 13:06:24
  4. Author : lucifer
  5. --%>
  6. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  7. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  8. "http://www.w3.org/TR/html4/loose.dtd">
  9. <jsp:useBean id="properties" class="beanpackage.SystemProperties"/>
  10. <html>
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  13. <title>JSP Page</title>
  14. </head>
  15. <body>
  16. Operating System Name:
  17. <jsp:getProperty name="properties" property="operatingSystemName"/>
  18. <br>
  19. Operating System Version:
  20. <jsp:getProperty name="properties" property="operatingSystemVersion"/>
  21. <br>
  22. Operating System Architecture:
  23. <jsp:getProperty name="properties" property="operatingSystemArchitecture"/>
  24. <br>
  25. <br>
  26. Runtime Environment Version(JDK version):
  27. <jsp:getProperty name="properties" property="runtimeEnvironmentVersion"/>
  28. <br>
  29. Runtime Environment Vendor(JDK vendor):
  30. <jsp:getProperty name="properties" property="runtimeEnvironmentVendor"/>
  31. <br>
  32. <br>
  33. VM Version:
  34. <jsp:getProperty name="properties" property="vmVersion"/>
  35. <br>
  36. VM Vendor:
  37. <jsp:getProperty name="properties" property="vmVendor"/>
  38. <br>
  39. VM Name:
  40. <jsp:getProperty name="properties" property="vmName"/>
  41. <br>
  42. <br>
  43. RTE Specification Version:
  44. <jsp:getProperty name="properties" property="rteSpecVersion"/>
  45. <br>
  46. RTE Specification Vendor:
  47. <jsp:getProperty name="properties" property="rteSpecVendor"/>
  48. <br>
  49. RTE Specification Name:
  50. <jsp:getProperty name="properties" property="rteSpecName"/>
  51. <br>
  52. <br>
  53. VM Specification Name:
  54. <jsp:getProperty name="properties" property="vmSpecName"/>
  55. <br>
  56. VM Specification Version:
  57. <jsp:getProperty name="properties" property="vmSpecVersion"/>
  58. <br>
  59. VM Specification Vendor:
  60. <jsp:getProperty name="properties" property="vmSpecVendor"/>
  61. </body>
  62. </html>
相关推荐
阅读 +