首页 > 代码库 > Jsp request

Jsp request

<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>   <head>     <base href="http://www.mamicode.com/">         <title>My JSP ‘index.jsp‘ starting page</title>  <meta http-equiv="pragma" content="no-cache">  <meta http-equiv="cache-control" content="no-cache">  <meta http-equiv="expires" content="0">     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">  <meta http-equiv="description" content="This is my page">  <!--  <link rel="stylesheet" type="text/css" href="http://www.mamicode.com/styles.css">  -->   </head>     <body>     <form action="show.jsp" method="post">     <ul style="list-style;none;line-height:30px">           <li>输入用户姓名:    <input type="text" name="name3"/><br/></li>             <li>Selet Sex:             <input name="sex" type="radio" value="http://www.mamicode.com/Male"/>Man             <input name="sex" type="radio" value="http://www.mamicode.com/Female" />Female        </li>               <li> selet password question:           <select name="question">             <option value="http://www.mamicode.com/mother birthday:">Mother birthday:</option>             <option value="http://www.mamicode.com/Pet name">Pet name</option>                    </select>        </li>        <li>请输入问题答案: <input type="text" name="key"/>  </li>         <li>selet your habit:          <div>            <input name="like" type="checkbox" value="http://www.mamicode.com/Singing and dancing" />Singing and dancing            <input name="like" type="checkbox" value="http://www.mamicode.com/surf on the Internet" />urf on the Internet            <input name="like" type="checkbox" value="http://www.mamicode.com/Climb" />Climb            <input name="like" type="checkbox" value="http://www.mamicode.com/Reading" />Reading           </div>       </li>        <li><input type="submit" value="http://www.mamicode.com/Submit"/>                          </ul>                 </form>     <ul style="line-height:24px">       <li>客户使用的协议:<%=request.getProtocol() %></li>       <li>客户端发送请求的方法:<%=request.getMethod() %></li>       <li>客户端请求路径:<%=request.getContextPath() %></li>       <li>客户机IP地址:<%=request.getRemoteAddr() %></li>       <li>客客户机名称:<%=request.getRemoteHost() %></li>       <li>客户机请求端口号:<%=request.getRemotePort() %></li>       <li>接受客户信息的页面:<%=request.getServletPath()%></li>       <li>获取报头中User-Aget值:<%=request.getHeader("user-agent") %></li>       <li>获取报头中Uaccept值:<%=request.getHeader("accept") %></li>       <li>获取报头中Host值:<%=request.getHeader("host") %></li>       <li>获取报头中accept-encoding值:<%=request.getHeader("accept-encoding") %></li>       <li>获取URI:<%=request.getRequestURI() %></i>       <li>获取URL:<%=request.getRequestURL()%></li>                       </ul>     </body> </html>