File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes basePath in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "basePath in jsp" Watch "basePath in jsp" New topic

basePath in jsp

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Hi all,

i am using eclipse..Here you see,every jsp file has the basePath(We have to do like below)..please anyone can explain me?why it is?
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<base href="<%=basePath%>">

thanks & regards,

[ March 31, 2008: Message edited by: Bear Bibeault ]
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

If you are looking for the meaning of the BASE tag, you can refer to this document.

[My Blog]
All roads lead to JavaRanch
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
Base URL is the URL which will appended with the relative path to give absolute path. Most of the time when you code, you will refer CS and JS files as relative paths.
Using this URL they will converted by the browsers to get the resources from the Server.
When you are not using this URL tag, then the current URL will be takes as the BASE URL PATH.

My Thoughts :
Try not to become a man of success but rather to become a man of value.
I agree. Here's the link:
subject: basePath in jsp
It's not a secret anymore!