zoukankan      html  css  js  c++  java
  • 获取客户端信息

    request对象提供了一些用来获取客户端的方法。

    input.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

    <body>
    <form action="showInfo.jsp" method="post">
    数据1:<input type="text" name="shuju1"><br>
    数据2:<input type="text" name="shuju2"><br>
    <input type="submit" value="提交">
    </form>
    </body>

    showInfo.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

    <body>
    <font color="blue">表单提交信息:</font><br>
    输入的第一个数据是:<%=request.getParameter("shuju1") %><br>
    输入的第二个数据是:<%=request.getParameter("shuju2") %><br>
    <font color="red">客户端信息:</font><br>
    客户端协议名和版本名:<%=request.getProtocol() %><br>
    客户机名:<%=request.getRemoteHost() %><br>
    客户机的IP地址:<%=request.getRemoteAddr() %><br>
    客户提交信息的长度:<%=request.getContentLength() %><br>
    客户提交信息的方式:<%=request.getMethod() %><br>
    HTTP头文件中Host值:<%=request.getHeader("Host") %><br>
    服务器名:<%=request.getServerName() %><br>
    服务器端口名:<%=request.getServerPort() %><br>
    接受客户提交信息的页面:<%=request.getServletPath() %><br>
    </body>

  • 相关阅读:
    2014华为上机题(转)
    c语言scanf详解
    Linux环境下Android JNI程序的编译
    C++中cin、cin.get()、cin.getline()、getline()、gets()等函数的用法
    容器化交付流程设计
    阿里云云计算相关术语概念
    k8s的部署策略
    pod控制器介绍
    Statefulset详细解析
    k8s持久化状态存储原理
  • 原文地址:https://www.cnblogs.com/ljs-666/p/7635156.html
Copyright © 2011-2022 走看看