JSP include 处理IECSS不兼容

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
int w1=6,w2=6;
String ie=request.getHeader("User-Agent"); //得到浏览器等相关信息
if(ie.indexOf("MSIE")!=-1) {//这里是msie 即微软 ie浏览器
out.write("<link rel='stylesheet' href='css/ie.css' type='text/css' />");

}else{
out.write("<link rel='stylesheet' href='css/other.css' type='text/css' />");
}
%>

相关推荐