Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java <;sec:authorize在某些jsp页面中不起作用_Java_Jsp_Spring Security - Fatal编程技术网

Java <;sec:authorize在某些jsp页面中不起作用

Java <;sec:authorize在某些jsp页面中不起作用,java,jsp,spring-security,Java,Jsp,Spring Security,我想显示经过身份验证的用户的名和姓。我将相关的代码段放在Header.jsp中,并将其包含在另外两个jsp页面中,Index.jsp和News.jsp 当Header.jsp包含在News.jsp中时,它工作正常并显示经过身份验证的用户的名字和姓氏,但当它包含在Index.jspm中时,它不会显示任何内容。 我的页面结构看起来像: Header.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageE

我想显示经过身份验证的用户的名和姓。我将相关的代码段放在Header.jsp中,并将其包含在另外两个jsp页面中,
Index.jsp
News.jsp

Header.jsp
包含在
News.jsp
中时,它工作正常并显示经过身份验证的用户的名字和姓氏,但当它包含在
Index.jsp
m中时,它不会显示任何内容。 我的页面结构看起来像:

Header.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

       <div class="usertext">
        <span id="loginedUserFullname">
             <sec:authorize access="isAuthenticated()">
               <sec:authentication property="principal.firstname" /> 
                      <sec:authentication property="principal.lastname" />
                  <span class="welcome">welcome</span>
                  <a class="logout" href='/view/cpanel/Logout.jsp'>(loge out)</a>
                  </sec:authorize>
         </span>

 </div>
</nav>

欢迎
Index.jsp

<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="">
<meta name="description" content="">
<jsp:include page="/includes/front/Head.jsp"></jsp:include>
<title></title>
</head>
<body>
    <jsp:include page="/includes/front/Header.jsp"></jsp:include>
    <jsp:include page="/includes/front/Scripts.jsp"></jsp:include>
</body>

News.jsp

<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="">
<meta name="description" content="">
<jsp:include page="/includes/front/Head.jsp"></jsp:include>
<title></title>
</head>
<body>
    <jsp:include page="/includes/front/Header.jsp"></jsp:include>
    <jsp:include page="/includes/front/Scripts.jsp"></jsp:include>
</body>


Index.jsp中不起作用的
有什么问题

Index.jsp是否可能不要求对用户进行身份验证,但News.jsp要求进行身份验证