ASCII码 ASCII码

JSP request(return String)用法详例

发布于:2022-03-30 12:48:59  栏目:技术文档
  1. JSP request(return String)用法详例
  1. JSP中request(return String)用法详例 ,需要的朋友可以参考下。
  2. 1.JSP代码 :
  1. <%--
  2. Document : index
  3. Created on : 2009-10-4, 12:45:43
  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. <html>
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  12. <title>JSP Page</title>
  13. </head>
  14. <body>
  15. get Scheme:
  16. <%=request.getScheme()%>
  17. <br>
  18. get Protocol:
  19. <%=request.getProtocol()%>
  20. <br>
  21. get Remote Address:
  22. <%=request.getRemoteAddr()%>
  23. <br>
  24. get Remote Host:
  25. <%=request.getRemoteHost()%>
  26. <br>
  27. get Server Name:
  28. <%=request.getServerName()%>
  29. <br>
  30. get Server Port:
  31. <%=request.getServerPort()%>
  32. <br>
  33. get Header:
  34. <%=request.getHeader("User-agent")%>
  35. <br>
  36. get Method:
  37. <%=request.getMethod()%>
  38. <br>
  39. get Request's URL:
  40. <%=request.getServletPath()%>
  41. <br>
  42. get Request URI:
  43. <%=request.getRequestURI()%>
  44. <br>
  45. get Request Session ID:
  46. <%=request.getRequestedSessionId()%>
  47. </body>
  48. </html>
  1. 2.输出:
  2. get Scheme: http
  3. get Protocol: HTTP/1.1
  4. get Remote Address: 0:0:0:0:0:0:0:1
  5. get Remote Host: 0:0:0:0:0:0:0:1
  6. get Server Name: localhost
  7. get Server Port: 8084
  8. get Header: Mozilla/5.0 (Windows; U; Windows NT 6.0; zh-CN; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
  9. get Method: GET
  10. get Request's URL: /Requests.jsp
  11. get Request URI: /TestRequest/Requests.jsp
  12. get Request Session ID: 6EF4EB4A3FE39A15EEBD4D46FBD0BA32
相关推荐
阅读 +