request 的常用方法:
request.getSchema()可以返回当前页面使用的协议,http 或是 https;
request.getServerName()可以返回当前页面所在的服务器的名字;request.getServerPort()可以返回当前页面所在的服务器使用的端口,就是80;
request.getContextPath()可以返回当前页面所在的应用的名字;
1.主的索引页面。
<%@page import="com.pay996.oil.service.impl.RiskTerminalServiceImpl"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.util.*" pageEncoding="UTF-8"%>
<%
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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<base href="<%=basePath%>">
<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="styles.css">
-->
</head>
<body>
<a href="risk/findUser.jsp">用户列表推送</a><br>
<a href="risk/subscribeCapital.jsp">订阅资金请求</a><br>
<a href="risk/unSubscribeCapital.jsp">退订资金请求</a><br>
<a href="risk/subscribeOrderInfo.jsp">订阅报单请求</a><br>
<a href="risk/unSubscribeOrderInfo.jsp">退订报单请求</a><br>
<a href="risk/subscribePosition.jsp">订阅持仓请求</a><br>
<a href="risk/unSubscribePosition.jsp">退订持仓请求</a><br>
<a href="risk/modifyAccount.jsp">强平</a><br>
<a href="javascript:window.history.go(-1);">返回</a>
</body>
</html>
2. 根据索引页面中的标签,点击,跳转到其他页面
<%@page import="com.pay996.oil.service.impl.RiskTerminalServiceImpl"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.util.*" pageEncoding="UTF-8"%>
<%
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="<%=basePath%>">
<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="styles.css">
-->
</head>
<body>
This is my JSP page. <br>
<form action="<%=basePath%>/risk/findUser.shtml" method="from">
<input type="submit" value="用户请求" style="height: 35px; ">
</form>
<a href="javascript:window.history.go(-1);">返回</a>
</body>
</html>