request.getScheme()的使用方法
2016-01-25 10:36
92 查看
1、request.getScheme() 返回当前链接使用的协议;比如,一般应用返回http;SSL返回https;
2、在程序中的应用如下:
Java代码
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
<base href="<%=basePath%>">
3、复习一下request 的常用方法:
request.getSchema()可以返回当前页面使用的协议,http 或是 https;
request.getServerName()可以返回当前页面所在的服务器的名字;
request.getServerPort()可以返回当前页面所在的服务器使用的端口,就是80;
request.getContextPath()可以返回当前页面所在的应用的名字;
2、在程序中的应用如下:
Java代码
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
<base href="<%=basePath%>">
3、复习一下request 的常用方法:
request.getSchema()可以返回当前页面使用的协议,http 或是 https;
request.getServerName()可以返回当前页面所在的服务器的名字;
request.getServerPort()可以返回当前页面所在的服务器使用的端口,就是80;
request.getContextPath()可以返回当前页面所在的应用的名字;
相关文章推荐
- Android如何执行一个不确定当前处于在子线程还是主线程中的UI操作
- UIPageViewController浅析
- 介绍MSAA,UIA ,Windows Automation API
- 在使用easyui,datagrid时,JSON中的如果含有换行符,则不能显示数据
- 一、使用系统自带UIRefreshControl进行下拉刷新
- MS UI Automation简介
- iOS开发笔记--关于设置UIView的背景为图片的方法以及问题
- UE4 代码编写细节:静态变量
- UITabelViewFootView(转)
- 使用WebRequest对象调用新浪天气预报<转>
- 《iOS Human Interface Guidelines》——Accessing User Data
- C#:使用WebRequest类请求数据
- UIImagePickerController 文字英文状态修改为中文
- 有限差分法Eluer算法(求解常微分方程)
- request 获取请求参数
- Request Header在网页端和API中的区别与联系
- UICollectionViewController既有headerView又有footerView。
- 安装配置Jira和Confluence集成环境
- Mac安装mosquitto错误
- *Maximum Length Palindromic Sub-Sequence of an Array.