title: How to show hide elements using spring security
body: <p>I have a button which i want to show in login page.</p>
  
  <p>So when the user is logged in i want to hide this button. I think </p>
  
  <pre><code>&lt;sec:authorize access="isAuthenticated()"&gt;
  </code></pre>
  
  <p>is useful for this so i included something like following in my jsp </p>
  
  <pre><code>&lt;sec:authorize access="not isAuthenticated()"&gt;
              &lt;div class="pull-right"&gt;
  </code></pre>
  
  <p>But is not visible in the login page as well as after logged in.</p>
  
  <p>What can be the problem.</p>
  
  <pre><code>&lt;http pattern="/foobar/static-wro4j/**" security="none"/&gt;
  &lt;http pattern="/foobar/static/**" security="none"/&gt;
  &lt;http pattern="/foobar/login*" security="none"/&gt;
  &lt;http pattern="/foobar/syndic/**" security="none"/&gt;
  &lt;http pattern="/foobar/register/**" security="none"/&gt;
  &lt;http pattern="/foobar/lostpassword/**" security="none"/&gt;
  
  &lt;http auto-config="true" use-expressions="true" create-session="ifRequired"&gt;
      &lt;remember-me key="foobarRememberKey" token-validity-seconds="2592000"/&gt;
      &lt;intercept-url pattern="/foobar/presentation" access="permitAll()"/&gt;
      &lt;intercept-url pattern="/foobar/tos" access="permitAll()"/&gt;
      &lt;intercept-url pattern="/foobar/license" access="permitAll()"/&gt;
      &lt;intercept-url pattern="/foobar/404-error" access="permitAll()"/&gt;
      &lt;intercept-url pattern="/foobar/500-error" access="permitAll()"/&gt;
      &lt;intercept-url pattern="/foobar/rest/users" method="POST" access="permitAll()"/&gt;
      &lt;intercept-url pattern="/metrics/**" access="hasRole('ROLE_ADMIN')"/&gt;
      &lt;intercept-url pattern="/**" access="isAuthenticated()"/&gt;
  
      &lt;form-login
              login-processing-url="/foobar/authentication"
              login-page="/foobar/login"
              authentication-failure-url="/foobar/login?action=loginFailure"
              default-target-url="/foobar/"
              authentication-success-handler-ref="foobarAuthenticationSuccessHandler"/&gt;
      &lt;http-basic/&gt;
      &lt;logout logout-url="/foobar/logout"
              logout-success-url="/foobar/login"/&gt;
  
      &lt;openid-login authentication-failure-url="/foobar/login?action=loginFailure"
                    user-service-ref="openIdAutoRegisteringUserDetailsService"&gt;
          &lt;!-- Only Google Apps is supported --&gt;
          &lt;attribute-exchange identifier-match="https://www.google.com/.*"&gt;
              &lt;openid-attribute name="email" type="http://axschema.org/contact/email" required="true" count="1"/&gt;
              &lt;openid-attribute name="firstname" type="http://axschema.org/namePerson/first" required="true"/&gt;
              &lt;openid-attribute name="lastname" type="http://axschema.org/namePerson/last" required="true"/&gt;
          &lt;/attribute-exchange&gt;
      &lt;/openid-login&gt;
  &lt;/http&gt;
  </code></pre>