title: Generating a link to a controller action in Play Framework 2.3
body: <p>I'm working on a Play application and need to generate links in a mixed Scala-HTML view that call controller actions. I found <a href="https://stackoverflow.com/questions/12447567/how-to-insert-link-to-controller-action-in-play-framework-2-0-template">this</a> question from a couple years ago that's similar to my situation, but the provided answers don't work for me.</p>
  
  <p>The elements are generated in a loop so I can't manually insert the argument to the controller action, but nothing I've tried has worked. This is the line I have now:</p>
  
  <pre><code>ID: @{var fhirID = &lt;processing for ID&gt;; &lt;a href='@routes.Users.fhirUserDetails(fhirID)'&gt;fhirID&lt;/a&gt;}
  </code></pre>
  
  <p>The accepted answer to the question I linked earlier effectively uses this structure too:</p>
  
  <pre><code>&lt;a href='@routes.Application.show("some")'&gt;My link with some string&lt;/a&gt;
  </code></pre>
  
  <p>My issue here is twofold:</p>
  
  <p>1) How can I have the variable fhirID passed to the controller action? My generated link simply has the text "fhirID" instead of what's generated by the first part of the statement.</p>
  
  <p>2) Is the @routes.Users syntax correct? When I click the generated link, it literally attempts to render a page at /myapp/@routes.Users.fhirUserDetails(fhirID)</p>
  
  <p>I realize I'm probably missing something very basic here- thanks for any advice!</p>