点击新建后,第二个页面,css样式不起作用了,打开后变成下面这样了
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<title>图书管理系统</title>
<script type="text/javascript">
</script>
</head>
<link rel="stylesheet" type="text/css" href="css/index.css">
<script type="text/javascript" src="js/index.js" defer="true"></script>
<script type="text/javascript" src="js/jQuery.js"></script>
<script type="text/javascript">
function del(s){
var s=s.id;
alert(s);
$("#table tr:not(:first)").html("");
$(function(){
$.ajax({
"url":"/ManageSystem/delcategory",
"type":"get",
"data":{id:s},
"dataType":"json",
"success":function(json){
for(var i=0;i<json.length;i++){
var s=i+1;
var vtd=$("<tr>"+"<td>"+s+"</td>"+"<td>"+json[i].cgid+ "</td>"+"<td>"+json[i].cgname+"</td>"+"<td>"+"<input type='button' onclick='del(this)' id="+json[i].cgid+" value='删除' >"+"</td>"+"</tr>")
$("#table").append(vtd);
}
},
})
})
}
</script>
<body>
<div class="head">
<input type="button" onclick="location.href='http://localhost:8080/ManageSystem/index.jsp'" value="分类管理" name="">
<input type="button" onclick="location.href='http://localhost:8080/ManageSystem/msbook.jsp'" value="图书信息管理" name="">
</div>
<div class="banner">
<span class="f1">图书管理系统</span></br>
<span class="f2">图书分类管理</span>
</div>
<div class="searche">
<input type="text" id="" name="" placeholder="请输入要查询的分类">
<input type="button" name="" value="查询">
</div>
<div class="main">
<table name="tb" id="table" >
<tr class="trname">
<td class="tdname">序号</td>
<td class="tdname">分类编号</td>
<td class="tdname">分类名称</td>
<td class="tdname">操作</td>
</tr>
<c:forEach items="${applicationScope.categoryList}" var="c" varStatus="indx" >
<tr class="trname">
<td class="tdname" name="tdnum">${indx.index+1}</td>
<td class="tdname" name="tdid">${c.cgid}</td>
<td class="tdname" name="tdname">${c.cgname}</td>
<td class="tdname" name="tddel"><input type="button" onclick="del(this)" value="删除" id="${c.cgid}"></td>
</tr>
</c:forEach>
</table>
</div>
<div class="add">
<a href="${pageContext.request.contextPath}/addcategory.jsp"><input type="button" id="createbtn" name="" value="新建"></a>
</div>
</body>
</html>
div{
margin-top: 5px;
width: 100%;
margin: 0 auto;
text-align: center;
position: relative;
}
.head{
height: 40px;
width: 90%;
border-bottom: 1px solid #D3D3D3;
position: relative;
}
.head input{
font-weight: bold;
border: 1px solid #A9A9A9;
margin: 0;
top: 20%;
left: 37%;
position: relative;
font-family:寰蒋闆呴粦;
}
.banner{
margin-top: 5px;
width: 80%;
height: 120px;
background: #D3D3D3;
position: relative;
}
.banner span{
left: -30%;
top: 25%;
position: relative;
font-family:寰蒋闆呴粦;
margin-top: 20px;
}
.banner .f1{
position: relative;
top: 20%;
font-size: 20px;
}
.banner .f2{
position: relative;
top: 30%;
font-size: 15px;
}
.searche {
width: 80%;
position:relative;
margin-top: 5px;
margin-bottom: 5px;
}
.searche input{
left: 40%;
position: relative;
}
.main{
width: 80%;
position: relative;
}
.main table{
width: 100%;
border: 0.5px solid #D3D3D3;
}
.main td{
font-family:寰蒋闆呴粦;
font-size: 15px;
}
.add{
width: 20%;
margin-top: 10px;
}
.add input{
color: white;
height: 30px;
width: 60px;
background-color: blue;
border: none;
font-family:寰蒋闆呴粦;
font-weight: bold;
font-size: 15px;
}
div{
margin:0 auto;
text-align: center;
width: 80%;
height:auto;
position: relative;
}
div p{
position: relative;
left: -40%;
}
.head{
height: 30px;
background-color: #F5F5F5;
border-top: 1px solid #A9A9A9;
border-bottom: 1px solid #A9A9A9;
position: relative;
}
.head p{
margin-top: 4px;
left: -45%;
}
.mian{
height: 160px;
background-color: #F5F5F5;
position: relative;
margin-top: 20px;
}
.mian p{
margin-top: 0px;
line-height: 30px;
position: relative;
left: -20%;
top: 20%;
font-size: 40px;
}
.mian .p2{
font-size: 20px;
}
.create{
height: 200px;
position: relative;
border: 1px solid #A9A9A9;
margin-top: 20px;
}
.create p{
left: -46%;
position: relative;
}
.create .crform{
width: 60%;
height: 60%;
position: relative;
}
.create .crform form{
text-align: right;
}
.create .crform form input[type="text"]{
margin-top: 10px;
width: 80%;
height: 60%;
}
.create .crform form input[type="submit"]{
margin-top: 10px;
width: 40px;
height: 25px;
position: relative;
right: 74%;
background-color: blue;
border:none;
color:white;
}
正在回答 回答被采纳积分+1
同学你好,如下提示是指将css样式解析为html,所以不能正确的显示样式,如:
同学是否增加了过滤器,可能是过滤器对css进行了拦截造成的。这里建议同学在过滤器中增加如下代码,清空浏览器的缓存再试试:
HttpServletRequest req =(HttpServletRequest) request; String url=req.getRequestURI(); if(url.indexOf(".css")>0||url.indexOf(".jpg")>0||url.indexOf(".png")>0) { chain.doFilter(request, response); return; }
祝:学习愉快~
- 参与学习 人
- 提交作业 676 份
- 解答问题 9666 个
本阶段将从前端网页搭建入手,到Java Web基础,前后端结合助你完成Java Web小白的蜕变!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星