title: Extracting ViewState when testing JSF with JMeter
body: <p>I'm using JMeter to do some load tests on my JSF application and I'm having trouble passing the ViewState along the pages. The ViewState variable doesn't get extracted at all or it doesn't get passed along the pages.</p>
  
  <p>I've recorded my test steps with a proxy server and this is what it looks like:</p>
  
  <p><img src="https://i.stack.imgur.com/oM2aa.png" alt="First GET Request"></p>
  
  <p>I've added the Regex extractor in the first GET request. Tested the regex and it is correct.</p>
  
  <p><img src="https://i.stack.imgur.com/iW1yA.png" alt="First POST Request"></p>
  
  <p>In every POST request I replace the hardwired View IDs with my variable. </p>
  
  <p>And what I get when I send the request is the following:</p>
  
  <p><img src="https://i.stack.imgur.com/9N4Qh.png" alt="Request sent"></p>
  
  <p>The POST parameters are incorrect, as it sends the name of the variable. </p>
  
  <p>POST data:</p>
  
  <blockquote>
    <p>loginForm%3ArequestToken=&amp;loginForm%3Ausername=heller&amp;loginForm%3Apassword=%21QAYxsw2%A7EDC&amp;loginForm%3AloginButton=Anmelden&amp;<strong>com.sun.faces.VIEW=%24%7BjsfViewState%7D</strong>&amp;loginForm=loginForm</p>
  </blockquote>
  
  <p>Could you tell what I'm doing wrong here?<br>
  Thanks!</p>