Meaningless Drivel is fun!*
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "basePath in jsp" Watch "basePath in jsp" New topic
Author

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">
<html>
<head>
<base href="<%=basePath%>">
-------------------------------------------

thanks & regards,
seetharaman



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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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 : http://passion4java.blogspot.com
Try not to become a man of success but rather to become a man of value.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: basePath in jsp