Home >Web Front-end >HTML Tutorial >To achieve absolute jsp jump, no project name is added in front. For example, jump directly to Baidu. _html/css_WEB-ITnose

To achieve absolute jsp jump, no project name is added in front. For example, jump directly to Baidu. _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:41:141729browse

For the convenience of jumping, the current jsp page has

<%	String path = request.getContextPath();	// 获得项目完全路径(假设你的项目叫MyApp,那么获得到的地址就是 http://localhost:8080/MyApp/):	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><head>  <base href="<%=basePath%>"></head>

added in front, so all href links are automatically added with the project name link http://localhost:8080/[project name]

Now, the page has two words "Baidu" and needs to be added with the link "www.baidu.com", so when you click the link, it becomes
"http://localhost:8080/[ Project name]/www.baidu.com”
How to solve this problem?


Reply to discussion (solution)

http://www.baidu.com
What about this?

Add http://
or use window.open("url"); this way

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn