Struts 中jsp页面导入.css样式文件的问题

1.可以更改路径为相对路径,在<html>前加入
<% String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>

然后改成href=<%=basePage%>css/style.css
2.同样在<html>前加入那句话,然后在<head>标签中加入
<base href=<%=basePath%>>

 

http://www.blogjava.net/alecwen/archive/2007/06/21/125613.html?opt=admin

你可能感兴趣的:(html,jsp,.net,struts,css)