title: JSP and JSTL with the Onclick method
body: <p>I have 2 links. In a session i store some data. I want if a user click in a specific link to look into the session and if the appropriate value contained, to continue. Else an AJAX pop up block will appears. </p>
  
  <p>JAVASCRRIPT pop up block</p>
  
  <pre><code> function displaymessage(title,message,close)
   {
  
          resultReturn= $.confirm({
          'title'     : title, 
          'message'   : message
          'buttons'   : {
          close/*'Yes'*/  : {
                  'class' : 'blue',
                                      'caption': close,
                  'action': function(){}
                          }           
                          }
                            });
     }
  </code></pre>
  
  <p>JSP with JSTL tags:</p>
  
  <pre><code>    &lt;div class="header"&gt;
          &lt;a href="&lt;c:url value='/home'/&gt;"&gt;
          &lt;a href="&lt;c:url value='/further'/&gt;"&gt;
      &lt;/div&gt;
  
       &lt;c:if test="${not fn:containsIgnoreCase(data, 'mykey')}"&gt; 
              &lt;a id="get" class="right keepScrollPosition" 
                 onclick="return displaymessage('&lt;spring:message code="access.denied.title"/&gt;'
                     ,'&lt;spring:message code="access.denied.message"/&gt;','&lt;spring:message code="access.denied.close"/&gt;');" 
                 href="#"  /&gt;&lt;/a&gt; 
          &lt;/c:if&gt;
  </code></pre>
  
  <p>For example, if in the session contained the value 'mykey',then can go into the link home, else a pop up will appears. In case, in the session contained the value 'mypassword' and select the further link can continue, but if select the home link a pop up block will appears.
  <em>I'm stuck and i need some help on how can i do this.Please help me</em></p>
  
  <p>UPDATE</p>
  
  <p>I'm trying the following script but it doesn't work:</p>
  
  <pre><code>  &lt;li&gt;&lt;a href="&lt;c:url value='/home/'/&gt;"&lt;spring:message code="home_page"/&gt;
          onclick="if(&lt;c:if test="${not fn:containsIgnoreCase(data, 'mykey')}"&gt;){
                      return displaymessage('&lt;spring:message code="access.denied.title"/&gt;' 
                 ,'&lt;spring:message code="access.denied.message"/&gt;','&lt;spring:message code="access.denied.close"/&gt;')" href="#" ;
         }
         &lt;/a&gt;
     &lt;/li&gt;
  </code></pre>