title: How do i embed java code inside jsf page?
body: <p>I have:
  A managed bean called "LoginBean". 
  A JSF page called "login.xhtml"</p>
  
  <p>In this jsf page, i have a login form.</p>
  
  <p>Inside the managebean i have a loginCheck function.</p>
  
  <pre><code>public void loginCheck(){
   if(logincorrect){
    //set user session 
   }else{
    //set lockout count session ++
   }
  }
  </code></pre>
  
  <p>What i want to do in my jsf page is that when the lock out count session == 2 (means users failed to login correctly 2 times, i need a recaptcha tag to be displayed.</p>
  
  <pre><code>&lt;td&gt;
      &lt;%
           if(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("numberOfLogins") == 2){
           &lt;p:captcha label="Captcha" requiredMessage="Oops, are you human?"/&gt;
         }
       %&gt;
  </code></pre>
  
  <p>    </p>
  
  <p>Apparently, the &lt;% tag does not work. Appreciate any help from java/jsf experts. </p>