title: How to create a constant using play framework 2.0 views
body: <p>Hi I'm using the play framework in Java</p>
  
  <p>I need to create a constant in a view and use it in a loop. </p>
  
  <p>To illustrate this will be the code in a view</p>
  
  <pre><code>@for(i &lt;- 1 to 7){
  @if(i&gt;=wd) {   //The constant wd is defined outside but in  
      &lt;td&gt;@cur++&lt;/td&gt;
  }else {
      &lt;td&gt;&lt;/td&gt;
      }
  }   
  </code></pre>
  
  <p>(I have to use wd many times and I think its a little ugly to pass it from the controller).
  Is there no way to just create a constant?</p>
  
  <p>I looked at</p>
  
  <pre><code>@defining(user.getFirstName() + " " + user.getLastName()) { fullName =&gt;
    &lt;div&gt;Hello @fullName&lt;/div&gt;
  }
  </code></pre>
  
  <p>but this doesn't seem to help 
  Thanks</p>