To add a base to a JSP page, you can use a relative path:
<% StringPath=Request.getcontextpath (); StringBasePath=Request.getscheme ()+ "://" +Request.getservername ()+ ":" +Request.getserverport ()+Path+ "/";%>
Then add base to the
<href= "<%=basePath%>"></base>
When you introduce an external file "directly" on this page, you can directly
<Scriptsrc= "Js/common/jquery-1.11.1.min.js"language= "JavaScript"type= "Text/javascript"></Script><Scriptsrc= "Js/common/frame.js"language= "JavaScript"type= "Text/javascript"></Script><Linkhref= "Css/common/frame.css"rel= "stylesheet"type= "Text/css" /><Linkrel= "shortcut icon"href= "Images/favicon.ico"type= "Image/x-icon" />
Similarly, the CSS classes in this page
{ position: absolute; Left: 0; top: 95px; Right: 0; height: 120px; background: url (images/common/title.jpg) repeat-x}
==================== Exception: The introduction of external CSS, JS files introduced in image and so on =================================
In this case, if you also use a relative path, because it is not in the JSP page, the relative path is relative to this CSS file in the same directory:
For example: Tang di new system, CSS file introduced in index.jsp page
<href= "Css/common/frame.css" rel= "stylesheet" type = "Text/css" />
at this point in the JSP page, the introduction of the Js/common/frame.js is from the site and directory to start looking for, no problem.
However, the following CSS is available in Frame.js
. Show_menu { background-image: url (images/left_bg.gif); background-repeat: repeat-y; background-position:285px 51px;}
In this case the direct URL (images/left_bg.gif) is the default from the directory where this CSS file is located (/css/common/frame.css) +url (images/left_bg.gif), So the image needed here needs to be configured separately,
Change into
. Show_menu { background-image: url (.. /.. /images/left_bg.gif); background-repeat: repeat-y; background-position:285px 51px;}
Problems with the introduction of relative paths to external resources in JSP, CSS