1. 程式人生 > >httpServletRequest.getContextPath() 和 getServletPath() 和 getRequestURL()

httpServletRequest.getContextPath() 和 getServletPath() 和 getRequestURL()

      String  contextPath  =  httpServletRequest.getContextPath();   //   為:/aimili

        String servletPath =  httpServletRequest.getServletPath();    //    為: /event/eventList.htm

        String path =  contextPath  +  servletPath ;


        String query = httpServletRequest.getQueryString();      //  name=1&key=3&class=5


        if (StringUtil.isNotEmpty(query)&& !"null".equals(query)) {  
             path += "?" + query;
       }

       httpServletRequest.getContextPath()

相關推薦

httpServletRequest.getContextPath() getServletPath() getRequestURL()

      String  contextPath  =  httpServletRequest.getContextPath();   //   為:/aimili         String servletPath =  httpServletReques

HttpServletRequest request 獲取header body

string () bsp body println span tel hole https //獲取header Enumeration headerNames = request.getHeaderNames(); while (headerNames.has

Java HttpServletRequest中getAttribute()方法getParameter()區別

  一、ServletRequest介面   HttpServletRequest介面繼承了ServletRequest介面,實現類通常代表一個實際的Http Request。   Servlet容器負責建立一個HttpServletRequest物件(在Web伺服器接收到瀏覽器的一個請求後),然後Ser

request.getServletPath()request.getPathInfo()用法

本文轉載於http://my.oschina.net/sub/blog/182408?fromerr=8xxvSrQt 在 Web 中,我們通常需要獲取 URL 相對於 Webapp 的路徑,主要是下面的幾個方法: ? 1

使用閉包代理Segue進行反向傳值

closure create 賦值 返回 protocol alt 類型 del uiview import UIKit class FirstViewController: UIViewController, SecondViewControllerDelegate

getContextPathgetServletPath、getRequestURI的區別

request 執行 result web print 名稱 ati 輸入 pri 假定你的web application名稱為example,你在瀏覽器中輸入請求路徑: https://localhost:8080/example/main/edit.jsp 則執行

Linux中環境變量/etc/profile ~/.bashrc ~/.bash_profile /etc/bashrc 的區別

linux中環境變量/etc/profile ~/.bashrc 和 ~/.bash_profile 和 /etc/bashrc 的區別 這個一定要理解登錄式shell和非登錄式shell的區別,前者是完全切換用戶,後者是不完全,就算切換過來了,你pwd時家目錄還是之前的家目錄,所以 登錄

forEachmapfor方法的區別

turn 而不是 ber num 遍歷數組 風格 cnblogs ron () 那麽接下來,我繼續做分析,為什麽更推薦用.map(),而不是.forEach()? 首先,.map()要比.forEach()執行速度更快。雖然我也說過執行速度不是我們需要考慮的主要因素,但是他

unity xml的讀取寫入創建

功能 edit eno sum load 定義 鏈接庫 cto tab unity xml的讀取和寫入 Xml是一種常用的數據格式,方便數據的索引查找 1.首先引入相關的動態鏈接庫: 1.1System.Data.dll 1.2Excel.DLL 1.3文件應用擡頭

SDSDHCSDXC卡的差別是什麽

link 12px 擴展 pos 32gb 滿足 宋體 padding 工作 SD內存卡和SDHC內存卡有什麽差別? SDHC和SD的差別事實上也就是SD 1.0/1.1規範和SD 2.0規範的差別。盡管編編手上有一份SD 1.1規範的文件。只是因為SD 2.0規範

公眾號appweb都是客戶端,都可以對接一個後臺

網站 clas span 端口 xxx 訪問 包括 包含 ext 1.公眾號和app和web都是客戶端,都可以對接一個後臺 2.域名中包含端口號嗎?:不包括,不包括 3.目前在IIS服務器上搭建了一個網站,域名也申請了,可是80端口不能使用,可以使用8000,每次訪問網

File的getPath()getAbsolutePath()getCanonicalPath()的差別

不同 int rda 前驅 一個 throw one 可能 java.net 這幾個方法是有一次無意的發現,我當時也不知道什麽意思,就百度了,查到了一些列子: 原文地址http://www.blogjava.net/dreamstone/archive/2007/08/

修飾符關鍵字繼承(一)

ati 構造 pub 常用 另一個 修飾 tro pri 修飾符 一、靜態修飾符----static   static可以修飾內部類、塊、屬性、方法,經static修飾過的元素儲存地址唯一,不會改變 1 public class Test{ 2 static

Python2inputraw_input區別Python3input的區別

input raw_inputPython2 input 和raw_input的區別input 用戶交互輸入數據字符串的時候需要加雙引號 用戶輸入數據的時候輸入的是幹什麽類型就是什麽類型 如,用戶輸入name則是變量類型 用戶輸入"name"則是字符串類型 用戶輸入"123"則是數字類型raw_i

js學習總結----callapplybind的區別

style 效果 兩個 是我 define 學習 處理 blog call() apply和call的方法是一模一樣的,都是用來改變方法的this關鍵字,並且把方法執行:而且在嚴格模式和非嚴格模式下對於第一個參數是null/undefined這種情況的規律是一樣的; bin

SERVICE_NAMESERVICE_NAMESGLOBAL_DBNAME的各自己定義

自己 spf inf sin form service 不同 call ids tnsnames.ora文件中邊SERVICE_NAME的參數值--對於動態註冊和靜態註冊。該參數有不同的取值 對於動態註冊: The followi

表單添加ipurl 當前時間

() com rip http return date src cnblogs name <input name="url" type="hidden" id="url"> <input name="ip" type="hidden" id="

(考研)散列表hashcodehashmap

兩個 code 作用 equal hash算法 too println 內容 import package tt; import java.util.HashMap; import java.util.Map; public class a0 { public

iptables防護CCDDosPPTP穿透腳本

sysconf mod protoc eas syn flood sysconfig -a 根據 config 一.iptables優化腳本案例 #!/bin/bash #腳本下載地址:#wget www.mrliangqi.com/pack/shell/iptables.

根據馬甲、應用商店、統計每天的註冊量,要求可以根據選擇馬甲app,馬甲appstroreuser_login不同表問題

統計 eat create group ror 一次 instr 發現 用戶登錄 這個馬甲屬於一個表,appStore另一張表,用戶登錄表,主要操作的就是這三個表。 我這裏的馬甲和app的id都與用戶登錄表中的channel對應,在channel存放的是majiaId +