我遇到一个奇怪的问题,当页面初始加载时,标题图块中的某些图标会展开。但是当刷新页面时,标题图块图标位于它们应该的位置:
以下是我在所有页面中包含的header.jsp文件的代码:
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%@page import="Entity.User" %>
<% User user = (User) session.getAttribute("user"); %>
<!DOCTYPE html>
<html>
<head>
<title>Fakebook</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="resources/css/bootstrap.css">
<link rel="stylesheet" href="resources/css/fakebookStyle.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="<% if(user!=null){ %>controller?funktion=newsfeed<% }else{ %>/index.html<% } %>">Fakebook</a>
<a href="#" class="iconStyle glyphicon glyphicon-envelope"></a>
<a href="#" class="glyphicon glyphicon-user"></a>
<a href="#" class="glyphicon glyphicon-globe"></a>
</div>
<form role="search" class="navbar-form navbar-left">
<div class="form-group">
<input type="text" placeholder="Search" class="form-control">
</div>
</form>
<% if(user != null){ %>
<div class="navbar-collapse collapse pull-right" style="margin-top: 15px;">
<a href="controller?funktion=profile"><b><%= user.getFornamn() %> <%= user.getEfternamn() %></b></a>
<a href="controller?funktion=logout" class="btn btn-default"><b>Logout</b></a>
</div><!--/.navbar-collapse -->
<% } else { %>
<div class="navbar-collapse collapse">
<form class="navbar-form navbar-right" role="form">
<div class="form-group">
<input type="text" placeholder="Email" class="form-control">
</div>
<div class="form-group">
<input type="password" placeholder="Password" class="form-control">
</div>
<button type="submit" class="btn btn-default">Sign in</button>
</form>
</div><!--/.navbar-collapse -->
<% } %>
</div>
</div>
我做错了什么?