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>

  • 相关阅读:
    spring Pom jar包版本管理
    Liunx 命令整理
    Centos&Nginx
    docker-compose
    .net core MemoryCache缓存
    .net core 程序集帮助类
    .NET CORE API Swagger
    Spring Boot (1)
    SQL Server生成实体
    1、认识和安装MongoDB
  • 原文地址:https://www.cnblogs.com/ljs-666/p/7635156.html
Copyright © 2011-2022 走看看