让样式文件,或js文件的相对路径,变成成绝对路径
添加两行代码即可
<% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()+ path + "/";%> <!DOCTYPE html> <html> <head> <base href="<%=basePath%>">