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>

  • 相关阅读:
    寒假作业3
    寒假作业2
    寒假作业
    Binary Indexed Tree
    Quick Union
    Prim's Algorithm & Kruskal's algorithm
    面向对象阶段总结 | 肆
    面向对象阶段总结 | 叁
    面向对象阶段总结 | 贰
    面向对象阶段总结 | 壹
  • 原文地址:https://www.cnblogs.com/ljs-666/p/7635156.html
Copyright © 2011-2022 走看看