title: Spring security. authorize doesn't work on jsp
body: <p>I had following jsp page and that jsp compiles as expected</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
  &lt;%@ taglib prefix="sprSec" uri="http://www.springframework.org/security/tags"%&gt;
  
  &lt;c:if test="${sessionScope.userName!=null}"&gt;
  
      ...
  
  &lt;/c:if&gt;
  </code></pre>
  
  <p>In login controller method I have following row:</p>
  
  <pre><code>session.setAttribute("userName", name);
  </code></pre>
  
  <hr>
  
  <p>I thought that better to rewrite it using spring security tags</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
  &lt;%@ taglib prefix="sprSec" uri="http://www.springframework.org/security/tags"%&gt;
  
  &lt;sprSec:authorize access="isAuthenticated()"&gt;
  
    ...
  
  &lt;/sprSec:authorize&gt;
  </code></pre>
  
  <p>And now I have following error when try to acces to page:</p>
  
  <pre><code>  org.apache.jasper.JasperException: org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/*/*****.jsp at line 5
  
      2: &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
      3: &lt;%@ taglib prefix="sprSec" uri="http://www.springframework.org/security/tags"%&gt;
      4: 
      5: &lt;sprSec:authorize access="isAuthenticated()"&gt;
      6: 
      7: &lt;c:set var="profileUrl" value="#" scope="request" /&gt;
      8:  &lt;sprSec:authorize ifAllGranted="ROLE_USER"&gt;
  
  
  ....
  
  root cause
  
  javax.servlet.ServletException: javax.servlet.jsp.JspException: java.io.IOException: No visible WebSecurityExpressionHandler instance could be found in the application context. There must be at least one in order to support expressions in JSP 'authorize' tags.
  ..........
  </code></pre>