limq

rainman
随笔 - 19, 文章 - 2, 评论 - 115, 引用 - 1
数据加载中……

Servlet 路径

首先建立一个测试页面:path.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
请求服务器:
<%= request.getServerName() %><br>
使用协议:
<%= request.getProtocol() %><br>
请求方法:
<%= request.getMethod() %><br>
请求断口号:
<%= request.getServerPort() %><br>
Context路径:
<%= request.getContextPath() %><br>
Servlet路径:
<%= request.getServletPath() %><br>
URI路径:
<%= request.getRequestURI() %><br>
查询字串:
<%= request.getQueryString() %><br>
<br>
使用者主機IP:
<%= request.getRemoteAddr() %><br>

<%= request.getRemotePort() %>
</body>
</html>

再用一下方式测试:
http://localhost:8080/WebModule1/path.jsp?name=justin&nick=caterpillar

结果为:
请求服务器: localhost
使用协议: HTTP/1.1
请求方法: GET
请求断口号: 8080
Context路径: /WebModule1
Servlet路径: /path.jsp
URI路径: /WebModule1/path.jsp
查询字串: name=justin&nick=caterpillar

使用者主?CIP: 127.0.0.1
1490

posted on 2005-03-01 23:29 limq 阅读(4539) 评论(1)  编辑  收藏

评论

# re: Servlet 路径   回复  更多评论   

大神,我首先得到协议是http1.1 ,我现在要在后台把他改成https的可以吗?
2012-05-29 14:27 | 柯可

只有注册用户登录后才能发表评论。


网站导航: